On this page本页内容
planCacheClearFilters Removes index filters on a collection. 删除集合上的索引筛选器。Although index filters only exist for the duration of the server process and do not persist after shutdown, you can also clear existing index filters with the 尽管索引筛选器仅在服务器进程期间存在,并且在关闭后不会持续存在,但您也可以使用planCacheClearFilters command.planCacheClearFilters命令清除现有索引筛选器。
Specify the query shape to remove a specific index filter. 指定要删除特定索引筛选器的查询形状。Omit the query shape to clear all index filters on a collection.省略查询形状以清除集合上的所有索引筛选器。
The command has the following syntax:该命令具有以下语法:
db.runCommand(
{
planCacheClearFilters: <collection>,
query: <query pattern>,
sort: <sort specification>,
projection: <projection specification>,
comment: <any>
}
)
The planCacheClearFilters command has the following field:planCacheClearFilters命令具有以下字段:
planCacheClearFilters | string | |
query | document |
|
sort | document | |
projection | document | |
comment | any |
|
A user must have access that includes the 用户必须具有包含planCacheIndexFilter action.planCacheIndexFilter操作的访问权限。
The orders collection contains the following two filters:orders集合包含以下两个筛选器:
{
"query" : { "status" : "A" },
"sort" : { "ord_date" : -1 },
"projection" : { },
"indexes" : [ { "status" : 1, "cust_id" : 1 } ]
}
{
"query" : { "status" : "A" },
"sort" : { },
"projection" : { },
"indexes" : [ { "status" : 1, "cust_id" : 1 } ]
}
The following command removes the second index filter only:以下命令仅删除第二个索引筛选器:
db.runCommand(
{
planCacheClearFilters: "orders",
query: { "status" : "A" }
}
)
Because the values in the 由于query predicate are insignificant in determining the query shape, the following command would also remove the second index filter:query谓词中的值在确定查询形状时无关紧要,因此以下命令还将删除第二个索引筛选器:
db.runCommand(
{
planCacheClearFilters: "orders",
query: { "status" : "P" }
}
)
The following example clears all index filters on the 以下示例清除orders collection:orders集合上的所有索引筛选器:
db.runCommand(
{
planCacheClearFilters: "orders"
}
)