Docs HomeMongoDB Manual

db.collection.configureQueryAnalyzer()

Definition定义

db.collection.configureQueryAnalyzer(options)

Configures query sampling for a collection on a replica set or sharded cluster. 为副本集或分片集群上的集合配置查询采样。Sampled queries provide information to analyzeShardKey to calculate metrics about read and write distribution of a shard key.采样查询为analyzeShardKey提供信息,以计算有关分片键的读写分布的度量。

The db.collection.configureQueryAnalyzer() method wraps the configureQueryAnalyzer command.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.包含描述旧配置的字段(如果存在)和描述新配置的字段的文档。有关详细信息,请参阅输出

Syntax语法

The method has the following syntax:该方法具有以下语法:

db.collection.configureQueryAnalyzer(
{
mode: <string>,
samplesPerSecond: <double>
}
)

Fields字段

db.collection.configureQueryAnalyzer() has the following fields:具有以下字段:

Field字段Type类型Necessity必要性Description描述
modestringRequired必要的Mode the query analyzer runs in. 查询分析器运行的模式。Must be set to either "full" or "off".必须设置为"full""off"
samplesPerSeconddoubleOptional可选的Number of samples per second. 每秒采样数。
  • When mode is set to "full", samplesPerSecond must be set between 0 and 50.mode设置为"full"时,samplesPerSecond必须设置在050之间。
  • When mode is set to "off", the server ignores samplesPerSecond.mode设置为"off"时,服务器会忽略samplesPerSecond
For details, see samplesPerSeconds Upper Limit. 有关详细信息,请参阅samplesPerSeconds上限

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示例

Learn More了解更多信息