Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1919

Sharding Shell Helper that Checks if the Cluster has a Config Shard

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • vNext
    • Affects Version/s: None
    • Component/s: sh, Shell API
    • 2
    • Needed
    • Hide

      Two new helpers added:

      sh.isConfigShardEnabled() returns whether a config shard is in use. The return value shape is:

      {
        enabled: <boolean>
        host?: <string>
        tags?: <string[]>
      }

      When `enabled` is false, `host` and `tags` are undefined. When it's true, `host` will be populated, while `tags` will be present if the config shard has any associated tags.

       

      sh.listShards() proxies into the listShards command and returns the .shards field - i.e. an array of objects representing each of the configured shards. The shape of the response is:

      {  
        _id: string;
        host: string;
        state: number;
        tags?: string[];
        topologyTime: Timestamp;
        replSetConfigVersion: Long;
      }
      Show
      Two new helpers added: sh.isConfigShardEnabled() returns whether a config shard is in use. The return value shape is: { enabled: <boolean> host?: <string> tags?: <string[]> } When `enabled` is false, `host` and `tags` are undefined. When it's true, `host` will be populated, while `tags` will be present if the config shard has any associated tags.   sh.listShards() proxies into the listShards command and returns the .shards field - i.e. an array of objects representing each of the configured shards. The shape of the response is: { _id: string; host: string; state: number; tags?: string[]; topologyTime: Timestamp; replSetConfigVersion: Long; }
    • Developer Tools

      In MongoDB 8.0 the sharded clusters now have the ability to run a config shard that stores cluster metadata and user collections. It would be nice if there was a shell helper that allowed an operator to quickly tell if the cluster has a config shard. 

      Running listShards and returning true or false determined by if there's a shard with an _id value of config seems like enough.

      Potential name - sh.configShardEnabled()

            Assignee:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Reporter:
            matt.panton@mongodb.com Matt Panton
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: