My Brain Cells

Easiest (and best) learning materials for anyone with a curiosity for machine learning and artificial intelligence, Deep learning, Programming, and other fun life hacks.

Getting Started With MongoDB

                               

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:

Most Commonly Used MongoDB Commands:

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


Name
Description
aggregate
Performs aggregation tasks such as group using the aggregation framework.
count
Counts the number of documents in a collection or a view.
distinct
Displays the distinct values found for a specified key in a collection or a view.
mapReduce
Performs map-reduce aggregation for large data sets

Anthony

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top