MongoDB Cheat Sheet
Introduction:
The database is a collection of inter-related data which is used to retrieve, insert and delete the data efficiently. The database is an important part of software and management solution.
MongoDB is an open-source database that uses a document-oriented data model, which means it stores data in JSON and one of the most powerful NoSQL databases. It doesn’t use the usual rows and columns, unlike relational database management.
Difference Between RDBMS & MongoDB:
Document Database:
A record in MongoDB is a document, which is a data structure composed of field and value pairs.MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents.
Important Features of MongoDB:
Creating a database
The following command will create a database named ‘database_name’ if it doesn’t exist. If it does exist, then it will be selected.
Command: Use Database_name
Dropping a database
The following command is used to drop a database, along with its associated files. This command acts on the current database.
Command: db.dropDatabase()
Aggregation Commands
|
---|