I have a document on my collection that has the id "info". I can search on Mongo Atlas easily with {_id: "info"}
filter, but when I try with Monk on Node, it tries to create the ObjectID and throw an error. How is the correct way of doing this search on Node?
Search using Atlas console:
const db = monk(url);
const rockets = db.get('rockets');
rockets.find({ _id: "info" }).then((docs) => {
console.log(docs);
})
Throw Error:
Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
at Function.createFromHexString
I just figure it out...
.find({ '_id': { $eq: "info" } })
Makes Monk stop trying to cast into ObjectID.