If your _id values ββare strings, you can query them just like any other field. (Remember that if you set custom values ββfor _id, they must be unique, or you will get a duplicate key error.)
Here is an example in Shell Mongo JS:
> db.test.insert({_id:"stringID1"}) > db.test.insert({_id:"stringID2"}) > db.test.insert({_id:"stringID3"}) > db.test.find({_id:"stringID1"}) { "_id" : "stringID1" } >
Is this what you were looking for? Hope I didnβt get you wrong!
source share