Query Plan Cache Methods

The PlanCache methods are only accessible from a collection’s plancache object. To retrieve the plan cache object, use thedb.collection.getPlanCache() method.

Note

For details on specific methods, including syntax and examples,click on the specific method to go to its reference page.

NameDescription
db.collection.getPlanCache()Returns an interface to access the query plan cache object andassociated 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 query shape.Accessible through the plan cache object of a specific collection,i.e. db.collection.getPlanCache().clearPlansByQuery()
PlanCache.getPlansByQuery()Displays the cached query plans for the specified query shape.Accessible through the plan cache object of a specific collection,i.e. db.collection.getPlanCache().getPlansByQuery().
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.listQueryShapes()Displays the query shapes for which cached query plans exist.Accessible through the plan cache object of a specific collection,i.e. db.collection.getPlanCache().listQueryShapes().