Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
*Location*: https://docs.mongodb.com/manual/reference/config-database/
*Referrer*: https://www.google.com/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
*Screen Resolution*: 2560 x 1440
Description
From what I can see from my Mongo 3.4 install, this line is incorrect:
When a databases have sharding enabled, the primary field holds the name of the primary shard.
The "primary" field contains the a shard name whether or not sharding is enabled for the database. The only reliable way to check if sharding is enabled is if the "partitioned" field has a value of true (as documented in https://docs.mongodb.com/manual/tutorial/view-sharded-cluster-configuration/).
For example:
mongos> db.databases.find()
|
{ "_id" : "db1", "primary" : "rs_prod_shard1", "partitioned" : true }
|
{ "_id" : "db2", "primary" : "rs_prod_shard1", "partitioned" : false }
|
Note, for the "db2" database, the "primary" field has a value, yet the "partitioned" field is false.