I have set up a mongo cluster as follows:
- Four shards =>
- Replica set of one configuration server =>
- One mongos server =>
- Shard key is a hashed index of
The entire setup is on a single server and the various mongod instances have been setup on different ports. (Setting up on a single server instead of different nodes has been a conscious decision though against recommended practices)
My server got terminated and I created a new cluster on another server with exact same settings as above using the old disks. The sharded collection document has a field:
url . For a particular id, if I search using
_id, mongos returns null but returns the object on finding using the
url. Connecting individually to shard2 returns the object on querying using same
_id. Some of the documents are found by querying on
_id through mongos and some are not.
Why is mongos unable to find the document using id? Can this be fixed?