-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Docs
-
Labels:
-
Empty show more show less
Description
The example provided here for working with promises is incorrect:
http://mongodb.github.io/node-mongodb-native/2.2/api/Db.html#collection
db.createCollection('test_correctly_access_collections_with_promise').then(function(err, result) { ... }
The "then" function does not receive an error. It just receives "result". Any error would be caught by a catch() function, which should also be shown.
In addition, this example contains several API calls, but only this one line that attempts to use promises, and the rest is a "pyramid of doom" using callbacks. The example should use promises and chain with then() throughout, with a final catch().