connect-mongodb icon indicating copy to clipboard operation
connect-mongodb copied to clipboard

Asynchronous execution of callback in MongoStore constructor

Open fschwehn opened this issue 12 years ago • 0 comments

The callback provided to the MongStore constructor is now executed asynchronuosly.

This makes sure that a variable assigned to the constructor call already has its value (and thus can be referenced from inside the callback) when executing the callback.

Example:

var store = new MongoStore(options, function(){
  // We now can use the newly created store directly inside the callback.
  // Prior to this version store would still be uninitialized at this point.
  store.doSomeFunkyStuff(...); 
});

fschwehn avatar Oct 06 '12 08:10 fschwehn