Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2946

mongorestore not working when roles are added

    • Type: Icon: Investigation Investigation
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 100.4.1, 100.5.0
    • Component/s: mongorestore
    • Labels:
    • Environment:
      docker pull mongo:5.0.2
      Ubuntu 20.04.2 LTS
      MongoDB 5.0.2
      mongodump 100.4.1
      mongorestore 100.4.1

      Problem Statement/Rationale

      It is not possible to perform a mongorestore after custom users was created.

      Steps to Reproduce


        1. MongoDB shell*
          db.test.insert( { item: "card1", qty: 15 } )
          db.test.insert( { item: "card2", qty: 30 } )
          db.test.insert( { item: "card3", qty: 45 } )
          db.test.insert( { item: "card4", qty: 60 } )
          db.test.insert( { item: "card5", qty: 75 } )
          *db.createUser({user: "testUser", pwd: "testpwd", roles: [ {role: "userAdminAnyDatabase" , db:"admin"}


        1. bash shell*
        1. MongoDB shell*
        1. bash shell*
          mongorestore --drop dump
          2021-08-19T09:11:05.021+0000 preparing collections to restore from
          2021-08-19T09:11:05.026+0000 reading metadata for test.test from dump/test/test.metadata.json
          2021-08-19T09:11:05.028+0000 dropping collection test.test before restoring
          2021-08-19T09:11:05.058+0000 restoring test.test from dump/test/test.bson
          2021-08-19T09:11:05.069+0000 finished restoring test.test (5 documents, 0 failures)
          2021-08-19T09:11:05.070+0000 restoring users from dump/admin/system.users.bson
          2021-08-19T09:11:05.111+0000 Failed: restore error: error running merge command: (Location40414) BSON field '_mergeAuthzCollections.tempRolesCollection' is missing but a required field
          2021-08-19T09:11:05.111+0000 5 document(s) restored successfully. 0 document(s) failed to restore.



      Expected Results

      The mongorestore finishes the restore successful with setting all data and users from the backup and returning an exit status of 0

      Actual Results

      Data gets restored but users not. mongorestore finishes with an exit status of 1

      Additional Notes

            evgeni.dobranov@mongodb.com Evgeni Dobranov
            ribelshaeuser@anynines.com Ralf Ibelshäuser
            0 Vote for this issue
            3 Start watching this issue