-
Type: Investigation
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 100.4.1, 100.5.0
-
Component/s: mongorestore
-
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
-
- 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"}]})*
- MongoDB shell*
-
- bash shell*
mongodump
- bash shell*
-
- MongoDB shell*
db.test.deleteMany({})
db.dropUser("testUser")
- MongoDB shell*
-
- 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.
- bash shell*
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
- I'm not sure if this is a general MondoDB or mongorestore issue. The restore works with older versions of MongoDB (tested successful with MongoDB 4.4.8)
- Related to this [question|https://www.mongodb.com/community/forums/t/mongorestore-not-working-when-roles-are-added/120220] at the community forum
- related to
-
TOOLS-2948 Add default empty string value for fields in MergeAuthzCollections command
- Accepted