PlanCache.clear()
On this page本页内容
Definition定义
PlanCache.clear()
-
Removes all cached query plans for a collection.
Importantmongosh Method
This page documents a
mongosh
method. This is not the documentation for database commands or language-specific drivers, such as Node.js.For the database command, see the
planCacheClear
command.For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.有关MongoDB API驱动程序,请参阅特定语言的MongoDB驱动程序文档。For the legacy对于遗留的mongoshell文档,请参阅相应MongoDB Server版本的文档:mongo
shell documentation, refer to the documentation for the corresponding MongoDB Server release:The method is only available from the该方法仅在特定集合的计划缓存对象中可用;即。plan cache object
of a specific collection; i.e.db.collection.getPlanCache().clear()
For example, to clear the cache for the例如,要清除orders
collection:orders
集合的缓存:db.orders.getPlanCache().clear()
Required Access所需访问权限
On systems running with 在使用authorization
, a user must have access that includes the planCacheWrite
action.authorization
运行的系统上,用户必须具有包括planCacheWrite
操作的访问权限。