mongodb-clone
v1.0.2
Published
performs mongodb collection clone from given source to given destination using streams
Downloads
4
Readme
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
© 2021 Martin Rafael [email protected]