Navigation

Find a Shard Key

To find the shard key of an existing sharded collection, use the db.printShardingStatus() method:

db.printShardingStatus()

For details on the db.printShardingStatus() output, see sh.status(). .. |copy| unicode:: U+000A9 .. |ent-build| replace:: MongoDB Enterprise .. |year| replace:: 2022 .. |hardlink| replace:: https://www.mongodb.com/docs/master .. |branch| replace:: master .. |bi| replace:: MongoDB Connector for BI .. 5.0 replace:: 5.0 .. |compass| replace:: MongoDB Compass .. |mdb-shell| replace:: MongoDB Shell