I\'m using Node.js with MongoDB, I\'m also using Monk for db access. I have the below code :
console.time(\"start\");
collection.findOne({name: \"jason\"},
Answer for question 1: Yes, you are right.
Is it because the async nature of Node.js.
And to prevent that Node.js provides some mechanism for that you can use it otherwise you can do it on your own manually by setting one flag.
Answer for question 2:
you can use $in
instead of findOne
, it will be ease and fast.
e.g. .find({ "fieldx": { "$in": arr } })
arr
:- In this you need to provide whole array.