mongosh Methods (original) (raw)

Note

JavaScript in MongoDB

Although these methods use JavaScript, most interactions with MongoDB do not use JavaScript but use anidiomatic driver in the language of the interacting application.

Note

For details on a specific method, including syntax and examples, click on the link to the method's reference page.

Atlas Search indexes let you query data in Atlas Search, while Atlas Vector Search indexeslet you query data in Atlas Vector Search. Atlas Search and Atlas Vector Search indexes enable performant text search queries by mapping search terms to the documents that contain those terms.

Use the following methods to manage Atlas Search and Atlas Vector Search indexes.

Atlas Stream Processorslet you perform aggregation operations against streams of continuous data using the same data model and query API that you use with at-rest data.

Use the following methods to manage Stream Processors:

Important

The following methods can only be run on deployments hosted onMongoDB Atlas.

Name Description
db.collection.getPlanCache() Returns an interface to access the query plan cache object and associated PlanCache methods for a collection.
PlanCache.clear() Clears all the cached query plans for a collection. Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().clear().
PlanCache.clearPlansByQuery() Clears the cached query plans for the specified plan cache query shape. Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().clearPlansByQuery()
PlanCache.help() Displays the methods available for a collection's query plan cache. Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().help().
PlanCache.list() Returns the plan cache information for a collection. Accessible through the plan cache object of a specific collection, i.e.db.collection.getPlanCache().list().

Note