【问题标题】:How to get the shard key of a given collection with MongoDB shell?如何使用 MongoDB shell 获取给定集合的分片键?
【发布时间】:2020-05-14 13:18:49
【问题描述】:

出于调查目的,我需要获取给定 MongoDB 集合的 shardkey。

db.getSiblingDB("mydb").mycollection.getIndexes() 给出所有索引。 db.getSiblingDB("mydb").mycollection.getShardDistribution() 给出了分片之间的分布。

获取分片键的命令是什么?

【问题讨论】:

    标签: mongodb sharding mongo-shell


    【解决方案1】:

    您可以使用db.printShardingStatus()。见文档here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-14
      • 1970-01-01
      • 2018-05-12
      • 1970-01-01
      • 2012-04-16
      • 1970-01-01
      相关资源
      最近更新 更多