promised-mongo icon indicating copy to clipboard operation
promised-mongo copied to clipboard

Use Bluebird v3

Open JaKXz opened this issue 9 years ago • 7 comments

First of all, this library looks great, thank you for forking :)

You mentioned that you're no longer using Q for your promise library since I assume you're now just using the native promise object.

May I suggest Bluebird because it offers a pretty comprehensive API and better performance, among other advantages.

JaKXz avatar Nov 12 '15 17:11 JaKXz

-1 for having non-native promises returned.

RangerMauve avatar Nov 12 '15 17:11 RangerMauve

@RangerMauve bluebird is a drop-in replacement for native promises, so I think it would be better to have a consistent Promise object returned rather than depending on the version of node you're running to have capabilities/methods you're looking for.

JaKXz avatar Nov 12 '15 17:11 JaKXz

I did just notice #26 though, apologies for duplicating.

JaKXz avatar Nov 12 '15 17:11 JaKXz

If we're talking about the standard Promise object, it'll have the same methods across all node versions. Bluebird is cool, but it's an extra dependency and an added api layer for people to potentially worry about. As well, as I recall Bluebird swallows uncaught errors by default, whereas uncaught native promises can be handled.

However, I could see bluebird being useful for a lot of situations where people actually want its functionality. Maybe it'd make sense to have the promise implementation get passed in during initialization? (or the suggestion for any-promise in #26, I guess)

RangerMauve avatar Nov 12 '15 17:11 RangerMauve

I'm not sure about Bluebird swallowing uncaught errors, but if you're talking about the .then(success, fail) anti-pattern, you should just have .catches across the board IMO.

JaKXz avatar Nov 12 '15 17:11 JaKXz

Well, the done() thing is an extension, without which one can't really detect when a promise chain will never get caught. That's why native promises will emit an event if they were never caught but were about to be garbage collected. Also, using catch() is definitely important, but sometimes people forget and then get confused as to why their stuff doesn't work but doesn't have errors.

RangerMauve avatar Nov 12 '15 17:11 RangerMauve

+1 Bluebird over native Promises

jvinai avatar Mar 09 '17 02:03 jvinai