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.The
db.collection.configureQueryAnalyzer()
method wraps theconfigureQueryAnalyzer
command.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
Note
This command is supported in all MongoDB Atlas clusters. For information on all commands, see Unsupported Commands.
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB
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 |
---|---|---|---|
mode | string | Required | Mode the query analyzer runs in. Must be set to either
"full" or "off" . |
samplesPerSecond | double | Optional | Number of samples per second.
For details, see samplesPerSeconds Upper Limit. |
Access Control
For details, see configureQueryAnalyzer Access Control.
Behavior
For behavior, see configureQueryAnalyzer Behavior.
Output
For details, see configureQueryAnalyzer Output.
Examples
For examples, see configureQueryAnalyzer Examples.