I am relatively new to Node.js and working on a project with MongoDB as database. Some of the MongoDB queries are expensive. For example, I have a collection with millions of records and based on the search criteria the find query can take 1-2 seconds.
Does the call to MongoDB (using Mongoose driver) block Node.js from processing other requests until MongoDB returns results?
Also, are there any tools to identify potential lines of code that are of a blocking nature?
Thank you.
MongoClient.connect('mongodb://127.0.0.1:27017/test', function(err, db)has a callback function(err, db) and is non- blocking.