-
Type: Bug
-
Resolution: Done
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
-
Environment:Any
-
Empty show more show less
Hi,
The documentation on Db.prototype.collection() has several problems:
1) It doesn't explain that, if strict mode is off, you can actually run it without the callback (it will return the collection straight)
To avoid nesting, in my application I do:
var users = db.collection('users');
var workspace = db.collection('workspaces');
... (add 5 more here)
The only thing that can go wrong is that I mistype the connection name, but hey, I am the developer and will surely notice... especially if this saves me from a million nested callbacks.
2) For "strict", the documentation (taken from the comment in the source) states:
- - *strict*, (Boolean, default:false) throws and error if collection already exists
It should be:
- - *strict*, (Boolean, default:false) throws and error if collection does not exist
Thanks!