Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bimedia-fr/mongo-bulk-writable
expose mongodb BulkOp as a writable stream
https://github.com/bimedia-fr/mongo-bulk-writable
Last synced: 8 days ago
JSON representation
expose mongodb BulkOp as a writable stream
- Host: GitHub
- URL: https://github.com/bimedia-fr/mongo-bulk-writable
- Owner: bimedia-fr
- License: apache-2.0
- Created: 2016-07-07T16:14:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-27T15:34:03.000Z (almost 8 years ago)
- Last Synced: 2024-12-08T08:07:45.459Z (28 days ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongo-bulk-writable
expose mongodb BulkOp as a writable stream## Install
> npm install --save mongo-bulk-writable
## Usage
Simple use case :
```js
var BulkWritable = require('mongo-bulk-writable');
var col; // get a collection object from driver
var writable = new BulkWritable(col.initializeOrderedBulkOp(), function write(chunk, next) {
this.bulk.insert(chunk);
next();
});
// pipe it
req.pipe(writable);```
Or```js
var BulkWritable = require('mongo-bulk-writable');
var col; // get a collection object from driver
var writable = new BulkWritable(col.initializeUnorderedBulkOp(), function write(chunk, next) {
this.bulk.find( { status: "P" } ).update( { $set: { comment: chunk.comment} } );
next();
});
// pipe it
req.pipe(writable);```