Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-6138

Comment on: "manual/reference/system-users-collection.txt"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • None
    • None

    Description

      var MongoClient = require('mongodb').MongoClient;
      MongoClient.connect(url, function(err, db) {
      var adminDb = db.admin();
      adminDb.addUser('admin', 'password', {
      roles:[

      { role: 'userAdmin', db: 'admin' }

      ,

      { role: 'userAdminAnyDatabase', db: 'admin' }

      ,

      { role: "readWrite", db: "PMDB" }

      ]});
      }
      I can add the account successfully, but I cannot use the mongoose to connect the "PMDB" with admin account. I don't know why...

      var connection = mongoose.connect('mongodb://admin:password@127.0.0.1:27017/PMDB');

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            415413233@qq.com Roger Luo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8 years, 23 weeks, 3 days ago