From 60f7aa75cde8d968f3707e9cc3c876935bfd239f Mon Sep 17 00:00:00 2001 From: David Glasser Date: Fri, 25 Oct 2013 00:20:34 -0700 Subject: [PATCH] a few random notes --- packages/mongo-livedata/mongo_driver.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/mongo-livedata/mongo_driver.js b/packages/mongo-livedata/mongo_driver.js index 13b2fe5ad3..851e7c05be 100644 --- a/packages/mongo-livedata/mongo_driver.js +++ b/packages/mongo-livedata/mongo_driver.js @@ -272,6 +272,7 @@ MongoConnection.prototype._startOplogTailing = function (oplogUrl, stopped = true; if (tailHandle) tailHandle.stop(); + // XXX should close connections too }, onOplogEntry: function (collectionName, callback) { @@ -316,9 +317,11 @@ MongoConnection.prototype._startOplogTailing = function (oplogUrl, // We need to make the selector at least as restrictive as the actual // tailing selector (ie, we need to specify the DB name) or else we // might find a TS that won't show up in the actual tail stream. - coll.findOne(baseOplogSelector(), {sort: {$natural: -1}}, function (err, lastEntry) { + coll.findOne(baseOplogSelector(), {fields: {ts: 1}, sort: {$natural: -1}}, function (err, lastEntry) { if (err) { - console.log("OH NO ERROR", err); + console.log("OH NO ERROR", err) + // call callback anyway, I guess + callback(); return; }