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
- Host: GitHub
- URL: https://github.com/devtin/mongodb-clone
- Owner: devtin
- Created: 2021-12-06T20:48:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-06T21:00:35.000Z (over 4 years ago)
- Last Synced: 2025-07-08T05:46:28.444Z (9 months ago)
- Language: JavaScript
- Size: 170 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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