iolo/mongoose-q — pull request #15 by darthtrevino (2014-05-14 23:48:30+00:00)
Title: Adding different promise providers (bluebird, when.js)

Hello!
I wanted to use bluebird promises without changing my semantics for interacting with mongoose. I've abstracted the promise implementation away from the core mongoose-q code into new 'promise provider' classes, which can be injected via the configuration object. The default implementation is 'Q'. Here's how I'm using mongoose-q with bluebird:

var BluebirdPromiseProvider = require('mongoose-q/lib/promise_providers/bluebird');
var mongooseQ = require('mongoose-q')(mongoose, {
spread: true
promiseProvider: new BluebirdPromiseProvider()
});

I've updated the unit tests so that they are generic and can be run for any promise provider implementation, and I've added test classes for Q, bluebird, and when.js. bluebird and when.js are now dev-dependencies. If a client needs those libraries, they should depend on it explicitly.

Thanks!
Chris