Does the action of getting data from mongo a blocking operation in node (if done incorrectly ?). What is the best way to make a query and also what should i avoid.I am using mongoosejs.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Andrei, Node makes synchronous & blocking stuff really hard to do, so don’t worry so much. I advise you read the official documentation from Mongoose and then take a look at the Nodepad application developed by Alex Young.
The tutorials for that application can be found here: http://dailyjs.com/tags.html#nodepad
Also in general, Mongoose & Node code usually look like this:
Other useful resources:
Is there any good MongooseDB Tutorial / example website?
Video presentations on Node.js & MongoDB from 10gen’s official website: http://www.10gen.com/presentations#programming_lang__javascript_nodejs
http://nodenerd.net/post/4926637100/quick-hit-mongoose-js
http://blog.mongodb.org/post/6587009156/cloudfoundry-mongodb-and-nodejs