Skip to content

bounoable/mongomove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongomove

PkgGoDev

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.

Installation

As a Command-line Tool:

go install github.com/bounoable/mongomove/cmd/mongomove@latest

As a Library:

go get github.com/bounoable/mongomove

Usage

Import All Databases

Move databases from one server to another:

mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018

Filter Databases By Prefix

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_

Skip Confirmation

To bypass the confirmation prompt:

mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -confirm

Insert Documents in Batches

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

Parallelize the Import Process

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

Disable Index Creation

Prevent the creation of indexes during import:

mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -indexes false

Enable Verbose Output

For a more detailed output:

mongomove -source mongodb://127.0.0.1:27017 -target mongodb://127.0.0.1:27018 -v

License

MIT.