From afe0560042bd176dfa27e183b65d29daa3e2b409 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 26 Jun 2015 01:47:59 -0700 Subject: [PATCH 1/2] fix should be bufferWithCount --- loopbackMigration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loopbackMigration.js b/loopbackMigration.js index 1a86352e46..31a0ef5545 100644 --- a/loopbackMigration.js +++ b/loopbackMigration.js @@ -7,6 +7,7 @@ var Rx = require('rx'), secrets = require('../config/secrets'); var MongoClient = mongodb.MongoClient; +Rx.config.longStackSupport = true; var providers = [ 'facebook', @@ -173,7 +174,7 @@ var commentCount = dbObservable .flatMap(function(dats) { return insertMany(dats.db, 'comment', dats.comments, { w: 1 }); }) - .buffer(20) + .bufferWithCount(20) .count(); Rx.Observable.combineLatest( @@ -198,7 +199,6 @@ Rx.Observable.combineLatest( console.error('an error occured', err, err.stack); }, function() { - console.log('finished with ', count); process.exit(0); } From f6c5e35f6660856abfd703a05261f2397b59d71b Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 26 Jun 2015 01:51:27 -0700 Subject: [PATCH 2/2] fix buffer return from database query --- loopbackMigration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopbackMigration.js b/loopbackMigration.js index 31a0ef5545..f6b98b8b7b 100644 --- a/loopbackMigration.js +++ b/loopbackMigration.js @@ -165,6 +165,7 @@ var commentCount = dbObservable .flatMap(function(db) { return createQuery(db, 'comments', {}); }) + .bufferWithCount(20) .withLatestFrom(dbObservable, function(comments, db) { return { comments: comments, @@ -174,7 +175,6 @@ var commentCount = dbObservable .flatMap(function(dats) { return insertMany(dats.db, 'comment', dats.comments, { w: 1 }); }) - .bufferWithCount(20) .count(); Rx.Observable.combineLatest(