Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native promises as default #2917

Closed
tamtakoe opened this issue Apr 27, 2015 · 11 comments
Closed

Use native promises as default #2917

tamtakoe opened this issue Apr 27, 2015 · 11 comments
Milestone

Comments

@tamtakoe
Copy link

Use native promises (node v 0.12+) as default. For old versions of node.js use old promise library

@Jokero
Copy link
Contributor

Jokero commented Apr 27, 2015

I agree. I use node 0.12 and can't use catch() without hack

@vkarpov15
Copy link
Collaborator

This will have to wait for 5.0, IMO qualifies as backwards-breaking. I agree with the suggestion though.

@vkarpov15 vkarpov15 added this to the 5.0 milestone Apr 27, 2015
@kencoken
Copy link

kencoken commented Jul 7, 2015

@Jokero – what is the hack you used? Fair enough that this is still a work in progress, but in the meantime it would be great if the ES6 compatibility page on the mongoose website could be updated. It currently states:

Documents in ES6

Asynchronous document functions return promises, and so are compatible with the ES6 yield keyword and libraries like co.

Given that the document is titled to suggest it is about support of ES6-native features, the use of the unqualified phrase 'promises' to me strongly implied native promises, particularly now that they are supported without any flags on the latest stable node 0.12.x (and consequently wrote a fair amount of code on that assumption before realising it was incorrect).

If you click through the link, it does indeed lead to the mpromises website, but in the meantime perhaps the page could be updated to explicitly state that only mpromises are supported right now (perhaps by just replacing 'promises' with 'mpromises') to avoid any confusion.

@Jokero
Copy link
Contributor

Jokero commented Jul 7, 2015

@kencoken, I use it:

require('mongoose/node_modules/mpromise').prototype.catch = function(onReject) {
    return this.then(undefined, onReject);
};

@vkarpov15
Copy link
Collaborator

See #2688

@kencoken
Copy link

@Jokero thanks for this! That's really helpful for now 👍

@DanielRamosAcosta
Copy link

Two years since this issue guys, are there any updates?

@vkarpov15
Copy link
Collaborator

No updates yet. Stay tuned 👍

@niftylettuce
Copy link
Contributor

@vkarpov15 Can we please remove lib/promise.js and use native Promises? We can put in engines of Mongoose's package.json for Node v6.4.0+.

@vkarpov15 vkarpov15 modified the milestones: Parking Lot, 5.0 Dec 5, 2017
@vkarpov15
Copy link
Collaborator

Yep that's the plan 👍

@vkarpov15
Copy link
Collaborator

Fixed in 5.0 branch.

loris added a commit to loris/cachegoose that referenced this issue Jan 22, 2018
boblauer pushed a commit to boblauer/cachegoose that referenced this issue Jan 22, 2018
* Upgrade deps to latest releases

* Add --exit flag to test script (required since mocha@4 - https://boneskull.com/mocha-v4-nears-release/#mochawontforceexit)

* Use native promises instead of mongoose Promise.ES6 (not provided in mongoose@5 anymore - Automattic/mongoose#2917)
tourbillonlabs pushed a commit to tourbillonlabs/react-native-parse-cache that referenced this issue Aug 14, 2019
* Upgrade deps to latest releases

* Add --exit flag to test script (required since mocha@4 - https://boneskull.com/mocha-v4-nears-release/#mochawontforceexit)

* Use native promises instead of mongoose Promise.ES6 (not provided in mongoose@5 anymore - Automattic/mongoose#2917)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants