Mclone tool to Copy or Sync two MongoDB server, databases, collections, indexes

Hi,

As a dev I sometime need a simple MongoDB cloning tool.
This is why I created mclone, inspired from rclone.

Copy or Sync two MongoDB server, databases, collections, indexes.
Works in 4 precise context
A) Destination is empty or use Force or Drop flag.
B) Collection are never updated, only add or remove records.
C) Collection contains a ‘sequence’ field, modified on each update.
D) Copy if you use OnlyAdd flag.

4 steps to create your first synchronisation.

  1. Create an empty json file.

mclone.exe -create [-config jsonFile]

  1. Edit the json file and set the two serveur uri

  2. Execute the populate function to get source server collection map.

mclone.exe -populate [-config jsonFile] [-render]

  1. Edit the json file if you want to exclude some databases or collections. Use Include flag.
    No need to edit it if you want all default options = basic synchronisation
    Force collection synchro with Force = true or ForceAllCollections = true.
    Set sequence field with SequenceField = ‘fieldName’.
    Avoid record deletion with OnlyAdd = true or OnlyAddAllCollections = true.

mclone.exe -sync [-config jsonFile]

To see current config summary

mclone.exe -render [-config jsonFile]

More infos on github.

Remi

3 Likes