To assign ranges to zones, from a mongo shell connected to a mongos instance, use the sh.updateZoneKeyRange() helper method. The generic syntax for the shell helper method is as follows:
sh.updateZoneKeyRange(DB.COLLECTION, MIN, MAX, ZONE);
The arguments are summarized here:
- DB.COLLECTIONÂ (string): This string represents the name of the database, and collection name, separated by a period.
- MIN (JavaScript Object Notation (JSON)): You can specify a JSON document that describes the shard key field/value key pair considered the lower bound of the range. This value is inclusive—that is to say: greater than or equal to. If the shard key contains multiple fields, you can include some or all of the fields in the MIN document, as long as you always include the prefix.
- MAXÂ (JSON): You can specify a JSON document that describes the shard key field/value key pair considered the upper bound of...