promised-mongo
promised-mongo copied to clipboard
Use Bluebird v3
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.
-1 for having non-native promises returned.
@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.
I did just notice #26 though, apologies for duplicating.
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)
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.
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.
+1 Bluebird over native Promises