如何使用 MongoDB shell 获取给定集合的分片键?
How to get the shard key of a given collection with MongoDB shell?
出于调查目的,我需要获取给定 MongoDB 集合的分键。
db.getSiblingDB("mydb").mycollection.getIndexes()
给出所有索引。
db.getSiblingDB("mydb").mycollection.getShardDistribution()
给出分片之间的分布。
获取分片键的命令是什么?
您可以使用 db.printShardingStatus()
。请参阅文档 here
出于调查目的,我需要获取给定 MongoDB 集合的分键。
db.getSiblingDB("mydb").mycollection.getIndexes()
给出所有索引。
db.getSiblingDB("mydb").mycollection.getShardDistribution()
给出分片之间的分布。
获取分片键的命令是什么?
您可以使用 db.printShardingStatus()
。请参阅文档 here