I have a collection that contains more than 800 million documents. Documents contain details about multiple countries. So I am planning to Shard based on the country code for e.g. US, UK, IN etc.
Also, I want to create Zones like USZone, UKZone and assign each shard to corresponding country zones. Now I have the following questions regarding the behaviour of Zones and Shards
Since I want to create shards based on the country code and I don’t want multiple countries present in a single shard, I thought of using hashed sharding. Please let me know if you think hashing strategy will not work.
Zones document talks about lower and upper boundaries when assigning shard to Zone. But in my case, there is no lower and upper boundary because I am sharding based on a 2-letter Country code. So how to assign a shard to Zone when there is no range involved?
After assigning US shard to US Zone, say after some time that shard went down. Now whether MongoDB will move incoming data (with country code as the US) to a different shard/zone or it will throw an error. If MongoDB moves the data to a different shard/zone then once the US shard comes back online whether already moved data will move to the US shard.
Thanks in advance.