문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top