The methods listed on this table of contents page are
mongosh methods. This is not the documentation for
Node.js or other programming language specific driver methods.
In most cases,
mongosh methods work the same way as the
mongo shell methods. However, some legacy methods
are unavailable in
For the legacy
mongo shell documentation, refer to the
documentation for the corresponding MongoDB Server release:
For MongoDB API drivers, refer to the language specific MongoDB driver documentation.
For details on a specific method, including syntax and examples, click on the link to the method's reference page.
Provides access to the aggregation pipeline.
Provides bulk write operation functionality.
Builds an index on a collection.
Builds one or more indexes on a collection.
Deletes a single document in a collection.
Deletes multiple documents in a collection.
Returns an array of documents that have distinct values for the specified field.
Removes the specified collection from the database.
Removes a specified index on a collection.
Removes all indexes on a collection.
Returns information on the query execution of various methods.
Performs a query on a collection or a view and returns a cursor object.
Atomically modifies and returns a single document.
Performs a query and returns a single document.
Finds a single document and deletes it.
Finds a single document and replaces it.
Finds a single document and updates it.
Returns an array of documents that describe the existing indexes on a collection.
Internal diagnostic method for sharded cluster.
Hides an index from the query planner.
Inserts a new document in a collection.
Inserts several new document in a collection.
Reports if a collection is a capped collection.
Returns latency statistics for a collection.
Performs map-reduce style data aggregation.
Rebuilds all existing indexes on a collection.
Deletes documents from a collection.
Changes the name of a collection.
Replaces a single document in a collection.
Reports on the state of a collection. Provides a wrapper around the
Reports the total size of a collection, including the size of all documents and all indexes on a collection.
Unhides an index from the query planner.
Modifies a single document in a collection.
Modifies multiple documents in a collection.
Establishes a Change Stream on a collection.
Performs diagnostic operations on a collection.