Navigation
This version will reach end of life on Feb 2018. To upgrade, go to the Learn more about upgrading your version of MongoDB.

listShards

On this page

Definition

listShards

Returns a list of the configured shards. listShards is only available for mongos instances. You can only issue listShards against the admin database.

The command takes the following form:

{ listShards: 1 }

Example

The following example returns the list of shards:

db.getSiblingDB("admin").runCommand( { listShards: 1 } )