i am trying to start a mongorestore from a dump that i have with the command :
mongorestore --uri="<MY_URI>" --nsFrom "<DB>" --nsTo "<DB>" --gzip --archive="<FILE>.tar.gz"
i get
2022-10-18T15:03:03.451+0300 The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2022-10-18T15:03:03.486+0300 preparing collections to restore from
2022-10-18T15:03:06.693+0300 0 document(s) restored successfully. 0 document(s) failed to restore.
after a long research it seems that the process is related to the way that mongodump was initially made
to clarify even further:
to dump a tar :
mongodump --uri="mongodb://<USERNAME>:<PASSWORD>@<IP_OF_YOUR_MONGO>:27017/<DB_TO_BE_DUMPED>" --gzip --archive=<DUMP_NAME>.tar.gz
after the dump was created , it can be restored with :
mongorestore --uri="mongodb://<USERNAME>:<PASSWORD>@<IP_OF_THE_MONGO_TO_BE_RESTORED_TO>:27017/<THE_NEW_DB_TO_BE>" --nsFrom "<THE_DB_THAT_WAS_DUMPED>" --nsTo "<THE_NEW_DB_TO_BE>" --gzip --archive="<DUMP_NAME>.tar.gz"