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

XMLWordPrintableJSON

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

      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
              Reporter:
              Tony Archer
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: