So, I want to do findOnemore than in Meteor, but through the Mongo shell. In short, I want to do something like this db.collection.findOne("thisIsAnId")and look for it in this collection.
I tried to upload a file that has this ...
db.collection.findOne = function(query, fields, options){
if(typeof query === "string") {
return db.collection.originalFindOne({_id : query}, fields, options);
}
return db.collection.originalFindOne(query, fields, options);
}
Where it originalFindOnewill simply snap to default findOne, this does not work at all. Therefore, with no luck finding a way to override the default function, I thought that maybe I could create a new type function db.collection.simpleFindOne()or something else, but I can’t find a way to bind it to the mongo shell so that it is accessible to any collection .
Does anyone have an idea of how the internal mango employees work that could help me?