Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4223

MongoDB repairDatabase returns unauthorized

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      centos 7 and mongodb version is 2.4.9

      I add a user with role

      ["readWrite","dbAdmin","clusterAdmin", "readWriteAnyDatabase", "dbAdminAnyDatabase"]

      but when i log in mongodb, and execute `db.repairDatabase()`, i get the error:

      { "ok" : 0, "errmsg" : "unauthorized"}

      .

      In the beginning, I just added role `readWrite` and `dbAdmin`, and added more and more roles, but encountered that error.

      I read https://docs.mongodb.org/manual/reference/built-in-roles/#built-in-roles, and it seems we can use `repairDatabase` when we have the dbAdmin role. But this doesn't seem to work. Can someone help me out of this problem? If you want more information, please tell me.

      my test script is in the attachment.

        1. test_script.sh
          0.9 kB
          tianmaofu

            Assignee:
            Unassigned Unassigned
            Reporter:
            findmyway tianmaofu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: