How to create zone covering entire range when hashed key is using?

Documentation says the following:

It is possible create a zone which covers the entire range of shard key values using minkey and maxkey to guarantee that MongoDB restricts all the data for a specific collection to the shard or shards in that zone.

Pls advise what values for minkey and maxkey should I use in order to create such an index.

Welcome to the MongoDB Community Forums @1111003 !

MinKey and MaxKey are special sentinel values in BSON that represent the smallest and largest possible key values.

An example of using these values in the MongoDB shell:

   { "_id" : MinKey },
   { "_id" : MaxKey },

Zone sharding is used to associate ranges of shard keys (or zones) with specific shards, so this feature generally does not make sense to use with hashed sharding or with all chunks assigned to a specific zone.

Can you provide some more information on the outcome you are trying to achieve?

For further information and examples please see the sh.updateZoneKeyRange() documentation.


There are 6 shards in our cluster but SHARD6 is designated for some specific data and we want to avoid ‘usual’ data appear there.
My idea is to add SHARD1 to SHARD5 to zone TEST and use this zone when sharding new collections.