sh.isConfigShardEnabled()
On this page
Definition
The sh.isConfigShardEnabled()
method returns whether
a cluster has a config shard.
If it does, then sh.isConfigShardEnabled()
also
returns the config shard's host and tag
information.
Syntax
sh.isConfigShardEnabled()
has the following
syntax:
sh.isConfigShardEnabled()
Behavior
sh.isConfigShardEnabled()
returns a document
that contains the following fields:
{ enabled: <boolean>, host: <string>, tags: [<string>] }
Field | Type | Description |
---|---|---|
| boolean |
|
| string | Hostname of config shard.
Only present if |
| array of strings | List of zones to which the shard belongs. |
Example
The following example shows how to run
sh.isConfigShardEnabled()
.
It shows the output when you run the method on
a cluster that has a config shard, but this shard
does not have any associated tags:
sh.isConfigShardEnabled()
{ enabled: true, host: 'shard3/localhost:27017' }
The following example shows the output if you
run sh.isConfigShardEnabled()
on a cluster
that has a config shard with associated tags:
{ enabled: true, host: 'shard3/localhost:27017', tags: ['tag1', 'tag2'] }