- Reference >
- Database Commands >
- Sharding Commands >
- listShards
listShards¶
On this page
Definition¶
-
listShards
¶ The
listShards
command returns a list of the configured shards in a sharded cluster.listShards
is only available onmongos
instances and must be issued against theadmin
database.The command takes the following form:
Example¶
The following operation runs listShards
against the
mongos
admin
database:
The following document is an example of the output from a
listShards
command:
Output¶
listShards
returns a document that includes:
A
shards
field which contains an array of documents, each describing one shard. Each document may contain the following fields:Field Description _id
The name of the shard. host
The hostname of the shard. If the shard is a replica set, host
lists the hostname of each mongod instance in the replica set.draining
If true, indicates that removeShard has been called for this shard and it is in the process of being drained. tags
A list of zones to which the shard belongs. maxSize
The configured maximum storage size of the shard in megabytes. This includes all data files on the shard including the local
andadmin
databases. If exceeded, this shard will not receive any more chunks.state
An internal field used during the addShard sequence to ensure that all steps and configuration necessary to add the shard to the cluster are completed. The
ok
status field, theoperationTime
field, and the$clusterTime
field for the operation. For details on these fields, see Response.