mongodb-bulk-stream
v0.0.2
Published
Pipe a stream of objects for bulk update/insert into MongoDB
Downloads
3
Maintainers
Readme
#mongodb-bulk-stream
Pipe a stream of objects for bulk update/insert into MongoDB
Usage
var pump = require('pump');
var count = require('count-stream');
var bulk = require('mongodb-bulk-stream');
var reloadZip = require('../lib/ReloadZipTransform');
var PackageProvider = require('../lib/PackageProvider');
var dao = new PackageProvider();
dao.open(function(error, collection, db) {
var pkgs = dao.streamAll();
pump(pkgs, reloadZip(db), bulk(collection), count(function(res) {
console.log('Updated:', res);
}), function(error) {
if (error)
console.error(error.toJSON());
dao.close(true, function() {
process.exit();
});
}).resume();
});
API
Coming Soon
##Install
npm install mongodb-bulk-stream