Callbacks not running when running debugger;

Problem

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.

Problem courtesy of: mikemaccana

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.

Solution courtesy of: mikemaccana

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.