1.0.2 • Published 2 years ago

mongodb-clone v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

mongodb-clone

This module stream's documents from the given collection source and pipes them to the collection destination:

Usage

Create a config file to store src and destination configuration:

// mongodb-clone.config.js

module.exports = {
  src: {
    credentials: 'mongodb://user:password@src-host:27017',
    database: 'src_database',
    collection: 'src_collection',
    query: {} // retrieve all documents
  },
  dst: {
    credentials: 'mongodb://user:password@dst-host:27017',
    database: 'dst_database',
    collection: `dst_collection_clone_${new Date().toLocaleDateString("en-US").replace(/\//g, '_')}`
  },
  flow: 1000 // amount of concurrent documents processed at once; avoids back-pressure
}

Then go ahead and:

npx mongodb-clone

License

MIT

© 2021 Martin Rafael tin@devtin.io