generator-express icon indicating copy to clipboard operation
generator-express copied to clipboard

Use bluebird as the promise engine for mongoose by default.

Open codevalve opened this issue 8 years ago • 3 comments

This would make the express-generator more stable since mpromise is deprecated.

mongoose.Promise = require('bluebird');

I will submit a pull request when I have it implemented.

codevalve avatar Jan 19 '17 21:01 codevalve

Do you have any reference on mpromise being deprecated? I can't find anything

petecoop avatar Jan 19 '17 22:01 petecoop

Mongoose was spitting out a warning about mpromise being deprecated and another promise library should be used. This warning stopped when I set

mongoose.Promise = require('bluebird');

It appears to be because that I'm using an exec method on a find.

I'm trying to nail down where the message comes from when I'm not using bluebird and instead the mpromise default.

This may be a simple case of sync vs. async and the mpromise library is not mean for async?

from Mongoose Promises for the MongoDB Driver

The mongoose.Promise property sets the promises mongoose uses. However, this does not affect the underlying MongoDB driver. If you use the underlying driver, for instance Model.collection.db.insert(), you need to do a little extra work to change the underlying promises library.

codevalve avatar Jan 19 '17 23:01 codevalve

I'm looking into what it would take to add this as an option in the generator instead of making it a default setting.

codevalve avatar Feb 07 '17 16:02 codevalve