From f63aeee8ebf8a289e2b35df309ca090e6826cd4d Mon Sep 17 00:00:00 2001 From: David Glasser Date: Thu, 10 Apr 2014 14:38:31 -0700 Subject: [PATCH] When initializing oplog tailing, only read 'ts' This means we read less data (yay), but more importantly it means that if the last entry contained custom EJSON types, we don't try to parse them. This code gets called synchronously from the first Meteor.Collection constructor, which can legitimately be before your EJSON.addType call. Fixes #2018. --- packages/mongo-livedata/oplog_tailing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mongo-livedata/oplog_tailing.js b/packages/mongo-livedata/oplog_tailing.js index b8dab965e7..e461038521 100644 --- a/packages/mongo-livedata/oplog_tailing.js +++ b/packages/mongo-livedata/oplog_tailing.js @@ -176,7 +176,7 @@ _.extend(OplogHandle.prototype, { // Find the last oplog entry. var lastOplogEntry = self._oplogLastEntryConnection.findOne( - OPLOG_COLLECTION, {}, {sort: {$natural: -1}}); + OPLOG_COLLECTION, {}, {sort: {$natural: -1}, fields: {ts: 1}}); var oplogSelector = _.clone(self._baseOplogSelector); if (lastOplogEntry) {