Definition定义
planCacheListFiltersLists the index filters associated with plan cache query shapes for a collection.列出与集合的计划缓存查询形状关联的索引筛选器。Returns:返回:Document listing the index filters. See Output.列出索引筛选器的文档。请参见输出。
Query Settings查询设置
Starting in MongoDB 8.0, use query settings instead of adding index filters. Index filters are deprecated starting in MongoDB 8.0.从MongoDB 8.0开始,使用查询设置,而不是添加索引筛选器。索引筛选器从MongoDB 8.0开始就被弃用。
Query settings have more functionality than index filters. Also, index filters aren't persistent and you cannot easily create index filters for all cluster nodes. To add query settings and explore examples, see 查询设置比索引筛选器具有更多功能。此外,索引筛选器不是持久的,您无法轻松为所有集群节点创建索引筛选器。要添加查询设置并探索示例,请参阅setQuerySettings.setQuerySettings。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
Important
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令。
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Syntax语法
The command has the following syntax:该命令具有以下语法:
db.runCommand(
{
planCacheListFilters: <collection>
}
)Command Fields命令字段
The command has the following fields:该命令包含以下字段:
planCacheListFilters | ||
comment |
|
Required Access所需访问权限
A user must have access that includes the 用户必须具有包含planCacheIndexFilter action.planCacheIndexFilter操作的访问权限。
Output输出
The planCacheListFilters command returns the document with the following form:planCacheListFilters命令返回具有以下形式的文档:
{
"filters" : [
{
"query" : <query>
"sort" : <sort>,
"projection" : <projection>,
"collation" : <collation>,
"indexes" : [
<index1>,
...
]
},
...
],
"ok" : 1
}
planCacheListFilters.filtersThe array of documents that contain the index filter information.包含索引筛选器信息的文档数组。Each document contains the following fields:每个文档包含以下字段:planCacheListFilters.filters.queryThe query predicate associated with this filter. Although the与此筛选器关联的查询谓词。虽然queryshows the specific values used to create the index filter, the values in the predicate are insignificant; i.e. query predicates cover similar queries that differ only in the values.query显示了用于创建索引筛选器的特定值,但谓词中的值并不重要;即,查询谓词涵盖了仅在值上不同的类似查询。For instance, a例如,querypredicate of{ "type": "electronics", "status" : "A" }covers the following query predicates:{ "type": "electronics", "status" : "A" }的query谓词涵盖了以下查询谓词:{ type: "food", status: "A" }
{ type: "utensil", status: "D" }
planCacheListFilters.filters.sortThe sort associated with this filter. Can be an empty document.与此筛选器关联的排序。可以是空文档。
planCacheListFilters.filters.projectionThe projection associated with this filter. Can be an empty document.与此筛选器关联的投影。可以是空文档。
planCacheListFilters.filters.collationThe collation associated with this filter. Can be an empty document.与此筛选器关联的排序规则。可以是空文档。
planCacheListFilters.filters.indexesThe array of indexes for the plan cache query shape.计划缓存查询形状的索引数组。The plan cache query shape is the combination of these fields:计划缓存查询形状是以下字段的组合:To choose the best query plan, the query optimizer evaluates the为了选择最佳查询计划,查询优化器会评估索引和集合扫描。indexesand the collection scan.
planCacheListFilters.okThe status of the command.命令的状态。