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

not authorized on [database_name] to execute command { insert: "[collection_name]", documents: [count], ordered: true, writeConcern: { w: 1 } }

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: MongoDB 3.2
    • Environment:
      macOS and ubuntu

      I want to preface that I have been trying this not only with Mongoose, but with the direct driver. In both cases I seem to be getting the issue:

      In my testing on this issue I've wiped out and reinstalled mongoose and any mongo folder as well. So I am currently using

      mongodb@2.2.11
      │ └── mongodb-core@2.0.13
      └── mongoose@4.6.8

      I am authorizing with an account which has dbOwner permissions.

      I am doing a bulk insert of around 600 records by using

      ModelName.insertMany( documentArray, function (err, results)

      {...}

      I get the following error:

      {
      "name": "MongoError",
      "message": "not authorized on appdb to execute command { insert: \"devices\", documents: 609, ordered: true, writeConcern:

      { w: 1 }

      }",
      "ok": 0,
      "errmsg": "not authorized on appdb to execute command { insert: \"devices\", documents: 609, ordered: true, writeConcern:

      { w: 1 }

      }",
      "code": 13
      }
      However I have logged in both from my client and locally on the server and can perform db.devices.insertMany operations just fine, so it doesn't seem to be a permissions issue.

      I've been looking for a solution for hours and can find none.

            Assignee:
            Unassigned Unassigned
            Reporter:
            tarcher Tony Archer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: