Tuesday, 10 September 2013

Waiting a few callbacks from MongoDB in NodeJS

Waiting a few callbacks from MongoDB in NodeJS

I have a few .find() queries and I'm not sure what's a good way to wait
for all callbacks to finish.
I mean, I could do some counter and increment it on each callback function
and check on it every time it changes, but I feel like this is really
durty.
Then there are some libraries like async and Q, but I'm not really sure I
want to use them just to wait for a few callbacks.
So, my question is: Have you suffered the same problem and how did you fix
it?

No comments:

Post a Comment