Reputation: 175
If I do create a hashed index with ensureIndex({ _id: "hashed"})
will Mongo know to take any queries on the _id
field and run them against the hashed index? Or do I need to update all the queries that use _id to be the _id_hashed
?
Upvotes: 0
Views: 1739
Reputation: 4218
Mongodb doesn't modify the _id
field when a hashed index is created. It will do the right thing, and query against _id
appropriately. The hash will only be used to query and balance the shards.
Upvotes: 1