3 added 119 characters in body
source | link

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can and probably should be omitted, since this only compresses the data in the pipe (on the bus of the machine executing the command), but not the data (over the wire) between the databases and the machine executing the command. Maybe it just causes unnecessary computing overhead. If I'm not mistaken, MongoDB compresses the data over the wire anyway (between server and driver).

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can and probably should be omitted, since this only compresses the data in the pipe, but not the data between the databases and the machine executing the command.

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can and probably should be omitted, since this only compresses the data in the pipe (on the bus of the machine executing the command), but not the data (over the wire) between the databases and the machine executing the command. Maybe it just causes unnecessary computing overhead. If I'm not mistaken, MongoDB compresses the data over the wire anyway (between server and driver).

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.

2 added 148 characters in body
source | link

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can and probably should be omitted, since this only compresses the data in the pipe, but not the data between the databases and the machine executing the command.

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can be omitted

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can and probably should be omitted, since this only compresses the data in the pipe, but not the data between the databases and the machine executing the command.

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.

1
source | link

The accepted answer didn't work for me, since it was lacking some parameters:

mongodump --host source:port --db databasename --gzip --archive | \
mongorestore --drop -vvvvvv -h target:port --db databasename --gzip --archive

--gzip can be omitted

--archive without a filename writes to stdout and reads from stdin respectively, if no filename is given

--drop fully replaces the target database.