mongomove
is a utility tool that facilitates the migration of databases from
one MongoDB server to another. It's especially handy for transferring data
between remote servers and local development environments.
go install github.com/bounoable/mongomove/cmd/mongomove@latest
go get github.com/bounoable/mongomove
Move databases from one server to another:
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018
Migrate databases that start with a specific prefix:
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -prefix my_
To bypass the confirmation prompt:
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -confirm
Specify the number of documents to process in a single batch (default is 100):
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -b 500
Set the number of concurrent database imports. By default, mongomove
uses the number of CPUs available:
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -p 2
Prevent the creation of indexes during import:
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -indexes false
For a more detailed output:
mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -v
MIT.