I'm trying to dump an existing MongoDB into a new MongoDB without using dump files at all.
Is there a way to pass data from mongodump into mongorestore using pipes?
something like this:
mongodump --host=0.0.0.0 --port=27017 --db=database_name | mongorestore --host 0.0.0.0 -d database_name --port 27000
Thanks!
I found this solution:
Explained:
mongodumpa MongoDB util to dump (backup) a database-vvvvvv for verbose, write to stdout the output of the command, more data perv, you can use-v-vv-vvvetc...--hostspecify the host of the MongoDB you want to dump--hostspecify the port of the MongoDB you want to dump--archivewrites the output to a specified archive file or, if the archive file is unspecified, writes to the standard output (stdout)|takes the output of the command and passes it as input to the next commandmongorestorea MongoDB util to restore a database