MongoDB CRUD Reference

Query Cursor Methods

Name Description
cursor.count() Returns the total number of documents in a cursor.
cursor.explain() Reports on the query execution plan, including index use, for a cursor.
cursor.hint() Forces MongoDB to use a specific index for a query.
cursor.limit() Constrains the size of a cursor’s result set. Returns the next document in a cursor.
cursor.skip() Returns a cursor that begins returning results only after passing or skipping a number of documents.
cursor.sort() Returns results ordered according to a sort specification.
cursor.toArray() Returns an array that contains all documents returned by the cursor.

Query and Data Manipulation Collection Methods

Name Description
db.collection.count() Wraps count to return a count of the number of documents in a collection or matching a query.
db.collection.distinct() Returns an array of documents that have distinct values for the specified field.
db.collection.find() Performs a query on a collection and returns a cursor object.
db.collection.findOne() Performs a query and returns a single document.
db.collection.insert() Creates a new document in a collection.
db.collection.remove() Deletes documents from a collection. Provides a wrapper around an insert() and update() to insert new documents.
db.collection.update() Modifies a document in a collection.

MongoDB CRUD Reference Documentation

Write Concern Reference
Configuration options associated with the guarantee MongoDB provides when reporting on the success of a write operation.
SQL to MongoDB Mapping Chart
An overview of common database operations showing both the MongoDB operations and SQL statements.
The bios Example Collection
Sample data for experimenting with MongoDB. insert(), update() and find() pages use the data for some of their examples.