Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Use bluebird as the promise engine for mongoose by default. #208

Open
codevalve opened this issue Jan 19, 2017 · 3 comments
Open

Use bluebird as the promise engine for mongoose by default. #208

codevalve opened this issue Jan 19, 2017 · 3 comments

Comments

@codevalve
Copy link

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 codevalve changed the title Use bluebird as the promise engine for mongoose by default when using mongodb. Use bluebird as the promise engine for mongoose by default. Jan 19, 2017
@petecoop
Copy link
Owner

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

@codevalve
Copy link
Author

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
Copy link
Author

codevalve commented Feb 7, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants