databasemongodbrobo3tmongorestore

mongorestore -d mydatabase -c mycollections C:\Users\backup.bson.gz doesn't work


this is my first question here because i really don't know what to do.

So i got a Database named mydatabase. I also got a Collection named mycollection. And i got a Backup-File named backup.bson.gz.

I want to use a command in MongoDB / Robo 3T that restores the backup file onto the database.

Because of that i tried the mongorestore command but i get the error:

Error: Line 1: Unexpected identifier

I wrote the command as shown in the title.

Thank you in advance!


Solution

  • use flag --drop

    mongorestore -d mydatabase -c mycollections C:\Users\backup.bson.gz --drop