chilly_maximus
chilly_maximus

Reputation: 772

mongorestore 0 document(s) restored successfully. 0 document(s) failed to restore

Im trying to migrate mongo, from local to atlas. I did mongodump, it creted .gz archive properly.

However when i try to restore like below :

mongorestore --uri="mongodb+srv://<user>:<password>@xxxxx.ipmg6.mongodb.net/myDbName" --archive=mongodump_2021-05-22_09-05-44.gz --gzip

I see output

2021-05-23T07:25:01.340+0200    The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2021-05-23T07:25:01.350+0200    preparing collections to restore from
2021-05-23T07:25:01.360+0200    0 document(s) restored successfully. 0 document(s) failed to restore.

No error but also no documents processed. Any idea what is wrong? And i something there is no error or warning from mongo?

Upvotes: 12

Views: 5971

Answers (2)

Brndn
Brndn

Reputation: 846

This worked for me:

mongorestore --drop /dump --nsInclude="*"

The "/dump" bit is the path to the mongodump directory.

Upvotes: 4

chilly_maximus
chilly_maximus

Reputation: 772

Ok solution is that --nsInclude was missing. If one want to restore whole db then --nsInclude="*" should be used.

Upvotes: 15

Related Questions