mongodb/node-mongodb-native — pull request #1184 by anton-kotenko (2014-06-13 10:11:47+00:00)
Title: Make callbacks to be executed in right domain

Seems, that there are one more way to loose domain:
If connection for some reason is not ready, command is queued in commandsStore.
When connection is finally ready, commands from commandsStore are executed, but not in the domain, they has been pushed in queue.
Example, that reproduces such situation:
1. Break existing connection, imitating some kind of error (that makes next command to be queued in _commandsStore)
2. Try to execute count command. That's done in specially created domain.
3. Command is executed when new connection is ready due to auto_reconnect = true option.
4. debugDomain function is called (it is made in such way, that it tell's if it's called in wrong domain)

Pull request contains tests and fixes.