Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-30

Documentation wrong for db.collection()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Any

      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!

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            mercmobily Tony Mobily
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: