The most common thing I do in the mongo shell shell is to search for objects by ID, for example:
db.collection.find({_id: ObjectId("55a3e051dc75954f0f37c2f2"})
I do this over and over and I have to wrap the identifier over and over again with the ObjectId. I am sorry that I did not have an-- findByIdshaped abbreviated form, like what the mongoose provides. I feel that the shell should be smart enough to understand what I mean here, for example:
db.collection.find("55a3e051dc75954f0f37c2f2")
How can i do this? Or are there alternative ways to request id in mongo shell?
source
share