res.send(query.exec().then(function(data) {
var formattedData = format(data);
return data;
}));
the plugin does not work, since it is checking for the mongoose promise implementation in particular, and the then method returns a MPromise. It would be nice to be able to interoperate with thenables in general or, at least, to redefine mongoose.Promise#then to return mongoose.Promise instances.
instead of using instanceof checks for Promises we could add an isPromise() function which accepts an arg and checks if 'function' == typeof arg.then. pull request?
If I try to do something like:
the plugin does not work, since it is checking for the
mongoose
promise implementation in particular, and thethen
method returns aMPromise
. It would be nice to be able to interoperate with thenables in general or, at least, to redefinemongoose.Promise#then
to returnmongoose.Promise
instances.