Definition定义
db.collection.configureQueryAnalyzer(options)Configures query sampling for a collection on a replica set or sharded cluster. Sampled queries provide information to为副本集或分片群集上的集合配置查询采样。采样查询为analyzeShardKeyto calculate metrics about read and write distribution of a shard key.analyzeShardKey提供信息,以计算分片键的读写分布指标。Thedb.collection.configureQueryAnalyzer()method wraps theconfigureQueryAnalyzercommand.db.collection.configureQueryAnalyzer()方法封装了configureQueryAnalyzer命令。Returns:返回A document containing fields describing the old configuration, if one exists, and fields describing the new configuration. For details, see Output.包含描述旧配置的字段(如果存在)和描述新配置的字段的文档。有关详细信息,请参阅输出。
Compatibility兼容性
This method 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 method has the following syntax:该方法具有以下语法:
db.collection.configureQueryAnalyzer(
{
mode: <string>,
samplesPerSecond: <double>
}
)
Fields字段
db.collection.configureQueryAnalyzer() has the following fields:具有以下字段:
mode | "full" or "off"."full"或"off"。 | ||
samplesPerSecond |
|
Access Control访问控制
For details, see configureQueryAnalyzer Access Control.有关详细信息,请参阅configureQueryAnalyzer访问控制。
Behavior行为
For behavior, see configureQueryAnalyzer Behavior.有关行为,请参阅configureQueryAnalyzer行为。
Output输出
For details, see configureQueryAnalyzer Output.有关详细信息,请参阅configureQueryAnalyzer输出。
Examples示例
For examples, see configureQueryAnalyzer Examples.有关示例,请参阅configureQueryAnalyzer示例。