An open API service indexing awesome lists of open source software.

https://github.com/devtin/mongodb-clone

performs mongodb collection clone from given source to given destination using streams
https://github.com/devtin/mongodb-clone

Last synced: 8 months ago
JSON representation

performs mongodb collection clone from given source to given destination using streams

Awesome Lists containing this project

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:
```js
// 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:

```bash
npx mongodb-clone
```

* * *

## License

[MIT](https://opensource.org/licenses/MIT)

© 2021 Martin Rafael