MongoDB Official Cheat Sheet
MongoDB Official Cheat Sheet
Basic Commands
These basic help commands are available in the MongoDB Shell.
Create Operations
Create or insert operations add new documents to a collection. If the collection
does not exist, create operations also create the collection.
Read Operations
Read operations retrieve documents from a collection; i.e. query a collection for
documents.
Update Operations
Update operations modify existing documents in a collection.
Delete Operations
Delete operations remove documents from a collection.
Read Modifiers
Add any of the following to the end of any read operation
Aggregation Operations
Aggregation pipelines consist of one or more stages that process documents
and can return results for groups of documents.
Aggregation Operations
Single Purpose Aggregation Methods aggregate documents from a single
collection.
Indexing Commands
Indexes support the efficient execution of queries in MongoDB. Indexes are
special data structures that store a small portion of the data set in an
easy-to-traverse form.
db.users.dropIndex("account creation
Removes the account creation date index and
date", "account termination date")
the account termination date index from the
users collection.
db.collection.getIndexes() Returns an array of documents that
describe the existing indexes on a
collection.
db.users.getIndexes() Returns an array of documents that hold index
information for the users collection.
Replication Commands
Replication refers to the process of ensuring that the same data is available on
more than one MongoDB Server.
Sharding Commands
Sharding is a method for distributing or partitioning data across multiple
computers. This is done by partitioning the data by key ranges and distributing
the data among two or more database instances.
Database Methods
ff