restoring backup fails when db is not empty
Summary
When restoring backup to db that is not empty, everything fails.
Steps to reproduce
run backup restore on not empty mongo database
Expected behavior
backup restored
Actual behavior
backup fails
Relevant logs and/or screenshots
________________________________________________________
/ TASK [rocketchat : execute command in database service \
\ container] /
--------------------------------------------------------
\ ___-------___
\ _-~~ ~~-_
\ _-~ /~-_
/^\__/^\ /~ \ / \
/| O|| O| / \_______________/ \
| |___||__| / / \ \
| \ / / \ \
| (_______) /______/ \_________ \
| / / \ / \
\ \^\\ \ / \ /
\ || \______________/ _-_ //\__//
\ ||------_-~~-_ ------------- \ --/~ ~\ || __/
~-----||====/~ |==================| |/~~~~~
(_(__/ ./ / \_\ \.
(_(___/ \_____)_)
fatal: [rocketchat]: FAILED! => {"changed": true, "cmd": ["docker", "exec", "rocketchat-database", "mongorestore", "--archive=/dump/prod_rocketchat_backup.gz", "--gzip"], "delta": "0:00:15.134143", "end": "2017-03-16 07:50:37.310380", "failed": true, "rc": 1, "start": "2017-03-16 07:50:22.176237", "stderr": "2017-03-16T07:50:22.342+0000\tcreating intents for archive\n2017-03-16T07:50:22.380+0000\treading metadata for rocketchat.rocketchat_message from archive '/dump/prod_rocketchat_backup.gz'\n2017-03-16T07:50:22.380+0000\trestoring rocketchat.rocketchat_message from archive '/dump/prod_rocketchat_backup.gz'\n2017-03-16T07:50:25.118+0000\treading metadata for rocketchat.rocketchat_oembed_cache from archive '/dump/prod_rocketchat_backup.gz'\n2017-03-16T07:50:25.118+0000\trestoring rocketchat.rocketchat_oembed_cache from archive '/dump/prod_rocketchat_backup.gz'\n2017-03-16T07:50:25.378+0000\t rocketchat.rocketchat_message 8.78MB\n2017-03-16T07:50:25.378+0000\trocketchat.rocketchat_oembed_cache 12.5MB\n2017-03-16T07:50:25.378+0000\t\n2017-03-16T07:50:25.419+0000\treading metadata for rocketchat.rocketchat_statistics from archive '/dump/prod_rocketchat_backup.gz'\n2017-03-16T07:50:25.420+0000\trestoring rocketchat.rocketchat_statistics from archive '/dump/prod_rocketchat_backup.gz'\n2017-03-16T07:50:26.256+0000
I DUŻO CZERWONEGO TUTAJ DALEJ
Possible fixes
add --drop
flag to mongorestore
command