Question

Edit: This question was originally about a database issue, but it turns out to be nothing of the sort. @tymeJV was quite helpful in diagnosing the problem on Friday, but on Monday morning it's very obvious the cause has nothing to do with databases.

I'm updating the question (rather than deleting it) and adding the answer myself.

There was probably some kind of problem to start with, but in the end it was my debugging itself that was breaking things. My code was:

collections.somecollection.find({name:'somename'}).toArray(function(err, docs) {
  log('>>>', err,docs)          
})

debugger;

And I was wondering why the callback never fired.

Was it helpful?

Solution

The problem was the investigation itself: the debugger was pausing execution before the child scope could run its callbacks.

Eg:

collections.somecollection.find({name:'somename'}).toArray(function(err, docs) {
  log('>>>', err,docs)          
  debugger;
})

Shows the callback running.

Some bugs become obvious after a little rest. Hope that helps anyone else who's in a similar position.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top