Reputation: 21
I downloaded an agz file from an open-source site and i want ro restore the db data to my mongodb. Firstly i execute the command bellow and I got the data successfully.
mongorestore --gzip --archive=filename.agz --db filename
But not all data were restored.There is no space of my disk so that some data failed to be restored. Then I delete some files to get enough space and run that command again.
But this time the command line shows something like duplicate id error
. And no new data was added to db.
So I drop the database and run the command bellow:
mongorestore --gzip --archive=filename.agz --nsInclude filename
And after more than 10 mins I got this:
execution result
2022-01-07T11:10:01.015+0800 preparing collections to restore from
2022-01-07T11:22:16.628+0800 0 document(s) restored successfully. 0 document(s) failed to restore.
What happend? Where are my data? How can I solve this problem and get whole correct data from the agz file?
Upvotes: 0
Views: 2034
Reputation: 21
Use nsInclude
command
Change code like this and it works:
mongorestore --gzip --archive=filename.agz --nsInclude="*"
as the official site says, --db
has been deprecated and you should use --nsInclude
instead.
Before restore u`d better ensure there is enough space left in your disk.
Upvotes: 1