Remove excess debug statements from flattenUser.js
This commit is contained in:
@ -29,26 +29,21 @@ function createConnection(URI) {
|
|||||||
|
|
||||||
function createQuery(db, collection, options, batchSize) {
|
function createQuery(db, collection, options, batchSize) {
|
||||||
return Rx.Observable.create(function (observer) {
|
return Rx.Observable.create(function (observer) {
|
||||||
console.log('Creating cursor...');
|
|
||||||
var cursor = db.collection(collection).find({}, options);
|
var cursor = db.collection(collection).find({}, options);
|
||||||
cursor.batchSize(batchSize || 20);
|
cursor.batchSize(batchSize || 20);
|
||||||
// Cursor.each will yield all doc from a batch in the same tick,
|
// Cursor.each will yield all doc from a batch in the same tick,
|
||||||
// or schedule getting next batch on nextTick
|
// or schedule getting next batch on nextTick
|
||||||
cursor.each(function (err, doc) {
|
cursor.each(function (err, doc) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
|
||||||
return observer.onError(err);
|
return observer.onError(err);
|
||||||
}
|
}
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
console.log('hit complete');
|
|
||||||
return observer.onCompleted();
|
return observer.onCompleted();
|
||||||
}
|
}
|
||||||
console.log('calling onnext');
|
|
||||||
observer.onNext(doc);
|
observer.onNext(doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
return Rx.Disposable.create(function () {
|
return Rx.Disposable.create(function () {
|
||||||
console.log('Disposing cursor...');
|
|
||||||
cursor.close();
|
cursor.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -101,7 +96,6 @@ var userSavesCount = users
|
|||||||
})
|
})
|
||||||
.flatMap(function(dats) {
|
.flatMap(function(dats) {
|
||||||
// bulk insert into new collection for loopback
|
// bulk insert into new collection for loopback
|
||||||
console.log(dats);
|
|
||||||
return insertMany(dats.db, 'user', dats.users, { w: 1 });
|
return insertMany(dats.db, 'user', dats.users, { w: 1 });
|
||||||
})
|
})
|
||||||
// count how many times insert completes
|
// count how many times insert completes
|
||||||
@ -147,7 +141,7 @@ Rx.Observable.merge(
|
|||||||
count += _count * 20;
|
count += _count * 20;
|
||||||
},
|
},
|
||||||
function(err) {
|
function(err) {
|
||||||
console.log('an error occured', err, err.stack);
|
console.error('an error occured', err, err.stack);
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
console.log('finished with %s documents processed', count);
|
console.log('finished with %s documents processed', count);
|
||||||
|
Reference in New Issue
Block a user