mbostock/mongo-mock — pull request #1 by lamflam (2014-08-13 20:23:16+00:00)
Title: Updated Collections and added callback module to work with asynch tests.

I see the note that this is deprecated, but so far this is still the best mock library for mongodb that I've found. I plan to continue to use it and update it as I need to unless I can find a better library. If these changes seem reasonable I figured they would be more useful here since this repo will get much more attention than my own.

##### Callback

Added a callback module that runs the callback via setTimeout with a 0ms timeout. Running completely synchronously can break asynchronous tests because you run the callback before the original function completes. Using setTimeout places it in the event queue which allows the original function to complete.

##### Other

Minor updates to the parameters passed to the callback functions in Collection.js. More consistent with the current mongodb spec.