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

Documentation wrong for db.collection()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Any

      Description

      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!

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: