NoSQL
NoSQL
1.Introduction to NoSQL
2.Types of NoSQL Databases
3.Introduction to MongoDB
4.MongoDB Create ,Read, Query operators, Update, Delete, Aggregate and Indexes
• NoSQL technologies have been around since the 1960s, under various names, but are enjoying a
surge in popularity as the data landscape shifts and developers need to adapt to handle the sheer
volume and vast array of data generated from the cloud, mobile, social media, and big data.
• From viral celebrity tweets to life-saving information in electronic medical records, new data and
data types are being generated at a dizzying pace. NoSQL databases have evolved to help
developers quickly create database systems to store the new information and make it readily
available for search, consolidation, and analysis.
• Most nonrelational, high-performance databases, sometimes called “not only SQL,” can also
handle highly structured data—they just aren’t limited to fixed data models like relational (SQL)
databases.
• The four most common types of NoSQL databases are:
• MongoDB is a document database. It stores data in a type of JSON format called BSON.
• A record in MongoDB is a document, which is a data structure composed of key value pairs like the
structure of JSON objects.
• MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
• MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
• MongoDB Community: The source-available, free-to-use, and self-managed version of
MongoDB
Specify any unique column or column In MongoDB, the primary key is automatically
combination as primary key. set to the _id field.
aggregation (e.g. group by) aggregation pipeline
db.collection.insertOne()
db.collection.insertMany()
In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic
on the level of a single document.
db.collection.insertMany()
db.collection.find()
The returned document may vary depending on the number of documents that match the query criteria, and
the query plan used:
$or
$and
$in
$eq
$ne
$nin
$It
$gt
$regex
• Sort
A document that defines the sort order of the result set.
The sort parameter contains field and value pairs, in the following form:
{ field: value }
• Limit
• Skip
• Delete operations remove documents from a collection. MongoDB provides the following methods
to delete documents of a collection:
• db.collection.deleteOne()
• db.collection.deleteMany()
• Overview
• MongoDB provides clients the ability to perform write operations in bulk. Bulk write operations affect
a single collection. MongoDB allows applications to determine the acceptable level of
acknowledgment required for bulk write operations.
• The db.collection.bulkWrite() method provides the ability to perform bulk insert, update, and delete
operations.
• Parameter
• db.collection.aggregate(pipeline, options)
• Calculates aggregate values for the data in a collection or a view.
• Returns an array that holds a list of documents that identify and describe the existing indexes on
the collection, including hidden indexes and indexes that are currently being built.
• db.collection.getIndexes()