How can I do this in the MongoDB shell?
https://stackoverflow.com/a/14315888/8887398
Basically I'm trying to find objects by their ObjectId. All are failing so I assume it's trying to compare to string. I'm doing this directly in the MongoDB shell. Here's what I've tried:
db.myTestDB.find( {_id: 3254ummx213u5k815mn2v2 })
Result: SyntaxError: identifier starts immediately after numeric literal
db.myTestDB.find( {_id: "3254ummx213u5k815mn2v2" }
)
Result: Nothing
db.myTestDB.find( { "_id": "3254ummx213u5k815mn2v2" })
Result: Nothing
db.myTestDB.find( {_id: ObjectId("3254ummx213u5k815mn2v2") })
Result: Nothing
I just put a random ID in there for my examples, but I've verified the ID exists, and by looking on MongoDB Compass.