I head and always read that MongoDB driver (>2.0) for NodeJS supports promises. But the only examples I find are with the connect() and findOne() functions. While it works for those and I can get promises, it doesn't with aggregate() nor with find(). I get that's because they might be returning cursors, but since there is promise support, where are those promises? There must be a way to work with them. A link, an example or simple explanation would be so welcome :)
Thank you, Jordy.
Chain the result from find() or aggregate() to .toArray(). The documentation of toArray for the current mongodb nodejs driver is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With