title: Connecting to mongos on an Atlas Cluster to see Sharding Status
body: <p>I just need to perform an sh.status() command to see the sharding status of my mongodb database. <br>
  This command needs to be performed on a mongos, and it is not (yet) clear to me how to perform that. My guess is that I should simply launch a mongo shell from a mongos server directly, but Atlas does not seem to provide direct access to them (I may be wrong).</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>Here is the exception I get when I execute the command from a remote Mongo Shell connected to my cluster : </p>
  
  <pre><code>mongoc-shard-00-00-wddpo(mongos-3.6.0)[mongos] mydb&gt; sh.status()
  printStackTrace@src/mongo/shell/utils.js:73:15
  DBCollection.prototype.aggregate@/Users/jondoe/.mongorc.js:98:13
  sh.getRecentMigrations@/Users/jondoe/.mongorc.js:1388:28
  printShardingStatus@/Users/jondoe/.mongorc.js:1497:30
  sh.status@src/mongo/shell/utils_sh.js:89:5
  @(shell):1:1
  
  2017-12-12T16:31:59.985+0100 E QUERY    [thread1] uncaught exception:         aggregate failed: {
    "ok": 0,
    "errmsg": "The 'cursor' option is required, except for aggregate with the explain argument",
    "code": 9,
    "codeName": "FailedToParse",
    "$clusterTime": {
      "clusterTime": Timestamp(1513092719, 27),
      "signature": {
        "hash": BinData(0, "Ok0isqe1nHr+D/I9344pcNdxapA="),
        "keyId": NumberLong("6496824061736255491")
      }
    },
    "operationTime": Timestamp(1513092719, 27)
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Since I was using Mongo Shell 3.4, I updated to 3.6
  After some cleaning (I had to manually delete the home/.mongorc.js prior to installing 3.6 otherwise it had a mess) everything worked as expected</p>
  
  <pre><code>mongo "mongodb+srv://mongoc-wddpo.mongodb.net/mydb" --authenticationDatabase admin --username jondoe --password strongestpasswordever
  MongoDB shell version v3.6.0
  connecting to: mongodb+srv://mongoc-wddpo.mongodb.net/mydb
  MongoDB server version: 3.6.0
  Welcome to the MongoDB shell.
  For interactive help, type "help".
  For more comprehensive documentation, see
      http://docs.mongodb.org/
  Questions? Try the support group
      http://groups.google.com/group/mongodb-user
  mongos&gt; sh.status()
  --- Sharding Status --- 
    sharding version: {
      "_id" : 1,
      "minCompatibleVersion" : 5,
      "currentVersion" : 6,
      "clusterId" : ObjectId("5a2953b4841c53c7b10a53f5")
    }
    shards:
          {  "_id" : "Mongoc-shard-0",  "host" : "Mongoc-shard-0/mongoc-shard-00-00-wddpo.mongodb.net:27017,mongoc-shard-00-01-wddpo.mongodb.net:27017,mongoc-shard-00-02-wddpo.mongodb.net:27017",  "state" : 1 }
          {  "_id" : "Mongoc-shard-1",  "host" : "Mongoc-shard-1/mongoc-shard-01-00-wddpo.mongodb.net:27017,mongoc-shard-01-01-wddpo.mongodb.net:27017,mongoc-shard-01-02-wddpo.mongodb.net:27017",  "state" : 1 }
          {  "_id" : "Mongoc-shard-2",  "host" : "Mongoc-shard-2/mongoc-shard-02-00-wddpo.mongodb.net:27017,mongoc-shard-02-01-wddpo.mongodb.net:27017,mongoc-shard-02-02-wddpo.mongodb.net:27017",  "state" : 1 }
          {  "_id" : "Mongoc-shard-3",  "host" : "Mongoc-shard-3/mongoc-shard-03-00-wddpo.mongodb.net:27017,mongoc-shard-03-01-wddpo.mongodb.net:27017,mongoc-shard-03-02-wddpo.mongodb.net:27017",  "state" : 1 }
    active mongoses:
          "3.6.0" : 12
    autosplit:
          Currently enabled: yes
    balancer:
          Currently enabled:  yes
          Currently running:  no
          Failed balancer rounds in last 5 attempts:  0
          Migration Results for the last 24 hours: 
                  No recent migrations
    databases:
          {  "_id" : "config",  "primary" : "config",  "partitioned" : true }
                  config.system.sessions
                          shard key: { "_id" : 1 }
                          unique: false
                          balancing: true
                          chunks:
                                  Mongoc-shard-0  1
                          { "_id" : { "$minKey" : 1 } } --&gt;&gt; { "_id" : { "$maxKey" : 1 } } on : Mongoc-shard-0 Timestamp(1, 0) 
          {  "_id" : "mydb",  "primary" : "Mongoc-shard-1",  "partitioned" : false }
  </code></pre>