$shardedDataDistribution (aggregation)
On this page本页内容
Definition定义
$shardedDataDistribution
New in version 6.0.3.6.0.3版新增。Returns information on the distribution of data in sharded collections.返回有关分片集合中数据分布的信息。NoteThis aggregation stage is only available on此聚合阶段仅在mongos
.mongos
上可用。This aggregation stage must be run on the此聚合阶段必须在admin
database.admin
数据库上运行。The user must have the用户必须具有shardedDataDistribution
privilege action.shardedDataDistribution
权限操作。
Syntax语法
The shardedDataDistribution
stage has the following syntax:shardedDataDistribution
阶段具有以下语法:
db.aggregate( [
{ $shardedDataDistribution: { } }
] )
Output Fields输出字段
The $shardedDataDistribution
stage outputs an array of documents for each sharded collection in the database. shardedDataDistribution
阶段为数据库中的每个分片集合输出一个文档数组。These documents contain the following fields:这些文档包含以下字段:
ns | string | |
shards | array | |
shards.numOrphanedDocs | integer | |
shards.numOwnedDocuments | integer | |
shards.orphanedSizeBytes | integer | |
shards.ownedSizeBytes | integer |
Examples实例
db.aggregate( [
{ $shardedDataDistribution: { } }
] )
Example output:输出示例:
[
{
"ns": "test.names",
"shards": [
{
"shardName": "shard-1",
"numOrphanedDocs": 0,
"numOwnedDocuments": 6,
"ownedSizeBytes": 366,
"orphanedSizeBytes": 0
},
{
"shardName": "shard-2",
"numOrphanedDocs": 0,
"numOwnedDocuments": 6,
"ownedSizeBytes": 366,
"orphanedSizeBytes": 0
}
]
}
]