Recently I tried to take a backup from my current database using mongodump --archive. Since the MongoDB had deployed as a docker container and the backup command used docker exec -it, the dumped archive includes miscellaneous characters and unfortunately it can't be restored by mongorestore. You can check the backup command at below:
docker exec -it <CONTAINER> sh -c 'mongodump -d db --archive' > db.dump
Since the database is not available now, I need to restore the corrupted archive. At first attempt I tried to remove extra obvious characters manually but it wasn't enough. Then I decided to use Python to parse the archive but I couldn't neither serialize it as a bson nor decode the bytes.
Here it's a part of the archive which is read by Python as a binary file:
...\x85\x01\x00\x00\x02db\x00\x08\x00\x00\x00example\x00\x02collection\x00\x14\x00\x00\x00...
What's your suggestion for this issue? Do you know what is the encoding of mongodump --archive output? Any response would be appreciated...