Mongodb – the syntax of mongodump and mongorestore

mongodb

I have a problem in my exercise:

  1. Export the db atelier. For that, use the command ./mongodump -d atelier My answwer : $ mongodump -d atelier
  2. Import the contenu of the db atelier in the db atelier2. For that, use the command ./mongorestore (use –help for see options). My answer : $ mongorestore dump/atelier -d atelier2

It doesn't work. The contenu of atelier is never copied in the db atelier2, the db atelier2 give no results so it must contains the collections of the data base atelier. Why it doesn't work ?

Please help me

Thanks

Best Answer

The dump path has to be the final argument of mongorestore.

https://docs.mongodb.com/manual/reference/program/mongorestore/

mongorestore -v --db atelier2 dump/atelier

should do the trick. If not the verbose flag -v should give hints to the deeper cause.