Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
None
Description
The documentation on 'movePrimary' is incorrect on several counts:
- Usage
Current text:
Only use movePrimary when removing a shard from a sharded cluster.
Correct text:
Only use movePrimary when the database does not contain any collections with data
Justification: there are a number of use cases where you may want to do a 'movePrimary' on a database which does not contain any collections. The most notable use is to create a federated database: UN-sharded 'collectionA' lives in 'databaseA' which has a primary shard of 'shardA'; while UN-sharded 'collectionB' lives in 'databaseB' which has a primary shard of 'shardB';
- Warning:
Current text:
Before running movePrimary you must ensure that no sharded data exists on this shard.
Correct text:
Only use movePrimary when the database does not contain any collections with data.
Justification: Everything in the warning is true about sharded collections. However, in addition, if you use 'movePrimary' command on a database which contains an UN-sharded collection, any writes performed to that collection while the move is "in flight" may be lost.