db.collection.analyzeShardKey()
On this page本页内容
Definition定义
db.collection.analyzeShardKey(key, options)
-
Calculates metrics for evaluating a shard key for an unsharded or sharded collection.计算用于评估未排序或已分片集合的分片键的度量。Metrics are based on sampled queries.度量基于抽样查询。You can use您可以使用configureQueryAnalyzer
to configure query sampling on a collection.configureQueryAnalyzer
在集合上配置查询采样。
Syntax语法
db.collection.analyzeShardKey()
has this syntax:具有以下语法:
db.collection.analyzeShardKey(
{
key: <shardKey>,
keyCharacteristics: <bool>,
readWriteDistribution: <bool>,
sampleRate: <double>,
sampleSize: <int>
}
)
Fields字段
key | document | ||
keyCharacteristics | boolean | keyCharacteristics 。true . true 。 | |
readWriteDistribution | boolean | readWriteDistribution 。true . true 。 | |
sampleRate | double | sampleRate , you cannot set sampleSize .sampleRate ,则无法设置sampleSize 。0 , up to and including 1 .0 ,最大值为1 (含1 )。 | |
sampleSize | integer | sampleSize , you cannot set sampleRate .sampleSize ,则无法设置sampleRate 。sampleRate is not specified, the sample size defaults to sample size set by analyzeShardKeyCharacteristicsDefaultSampleSize . sampleRate ,则样本大小默认为analyzeShardKeyCharacteristicsDefaultSampleSize 设置的样本大小。 |
Behavior行为
For behavior, see analyzeShardKey Behavior.有关行为,请参阅analyzeShardKey
行为。
Access Control访问控制
For details, see analyzeShardKey Access Control.有关详细信息,请参阅analyzeShardKey
访问控制。
Output输出
For sample output, see analyzeShardKey Output.有关示例输出,请参阅analyzeShardKey
输出。
Examples实例
For examples, see analyzeShardKey Examples.有关示例,请参阅analyzeShardKey
示例。