jquery style .when(promise, promise) support for mongoose

npm install mongoose-when
7 downloads in the last day
11 downloads in the last week
27 downloads in the last month


Add jquery style .when support to mongoose promise object. Requires mongoose v3.6.1 or higher, no other requirements.

Use exactly like jquery.when on which this code is based.

Promise.when() returns a Mongoose promise object.

var mongoose = require('mongoose');
var Promise = mongoose.Promise;

var p1 = Users.find();
var p2 = Animals.find();
Promise.when(p1, p2).addBack(function(err, users, animals) {

See unit tests for for more usage examples.

npm loves you