Data not going into right shard

Created a sharded cluster and added tags NA and EU as explained in the example. Next added tag range as specified in the documentation https://docs.mongodb.com/manual/tutorial/sharding-segmenting-data-by-location/

When I insert a document with country as “US”, it put it in the EU shard. When I do sh.status() it says the collection has a active migration and there are no balancer failures. I checked the balancer and it is running.

Shouldn’t the data automatically go to correct cluster? Why is it putting in a different cluster? Also, why taking so long for balancer to move the document to correct cluster? Does it wait for certain number of documents before starting the move? The document that I inserted was very small with two fields one for the country and other userid.

Welcome to the community @prashant_kulkarni

Can you share the status of your sh.status() command?

What method are you using to determine what cluster the document is in ?

1 Like