MongoDB CRUD Reference

Query Cursor Methods

Name Description
cursor.count() Modifies the cursor to return the number of documents in the result set rather than the documents themselves.
cursor.explain() Reports on the query execution plan 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.
cursor.next() 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.
db.collection.save() 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
Description of the write operation acknowledgements returned by MongoDB.
Read Concern
Description of the readConcern option.
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.

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.