定义
sh.isConfigShardEnabled() 方法会返回集群是否具有 配置分片。如果是这样,sh.isConfigShardEnabled() 还会返回配置分片的托管和标签信息。
语法
sh.isConfigShardEnabled() 通过以下语法实现:
sh.isConfigShardEnabled() 
行为
sh.isConfigShardEnabled() 返回包含以下字段的文档:
{    enabled: <boolean>,    host: <string>,    tags: [<string>] } 
| 字段 | 类型 | 说明 | 
|---|---|---|
| 
 | 布尔 | 
 | 
| 
 | 字符串 | 配置分片的主机名。仅当  | 
| 
 | 字符串数组 | 分片所属的区域列表。 | 
例子
以下示例展示了如何运行sh.isConfigShardEnabled()。它显示了当您在具有配置分片的集群上运行该方法时的输出,但该分片没有任何关联的标签:
sh.isConfigShardEnabled() 
{ enabled: true, host: 'shard3/localhost:27017' } 
以下示例显示了如果您在具有带有关联标签的配置分片的集群上运行sh.isConfigShardEnabled() 的输出:
{   enabled: true,   host: 'shard3/localhost:27017',   tags: ['tag1', 'tag2'] }