diff --git a/packages/mongo-livedata/mongo_driver.js b/packages/mongo-livedata/mongo_driver.js index 2ccbc154a3..aaa9bc0b6c 100644 --- a/packages/mongo-livedata/mongo_driver.js +++ b/packages/mongo-livedata/mongo_driver.js @@ -149,12 +149,11 @@ MongoConnection = function (url, options) { self._docFetcher = new DocFetcher(self); self._oplogHandle = null; - // XXX we should NOT be reading directly from the env here (this should be an - // argument to MongoConnection eg) but I want to wait for the AppConfig API to - // settle a little before thinking too hard about this - if (process.env.XXX_OPLOG_URL && !options.isOplog) { + + if (options.oplogUrl) { + // XXX this parse fails on mongo URLs with commas! var dbName = Npm.require('url').parse(url).pathname.substr(1); - self._startOplogTailing(process.env.XXX_OPLOG_URL, dbName); + self._startOplogTailing(options.oplogUrl, dbName); } }; @@ -295,7 +294,7 @@ MongoConnection.prototype._startOplogTailing = function (oplogUrl, dbName) { // Actually setting up the connection and tail blocks, so we do it "later". Meteor.defer(function () { - var oplogConnection = new MongoConnection(oplogUrl, {isOplog: true}); + var oplogConnection = new MongoConnection(oplogUrl); // Find the last oplog entry. Blocks until the connection is ready. var lastOplogEntry = oplogConnection.findOne( diff --git a/packages/mongo-livedata/remote_collection_driver.js b/packages/mongo-livedata/remote_collection_driver.js index 41502c17eb..552974aa5d 100644 --- a/packages/mongo-livedata/remote_collection_driver.js +++ b/packages/mongo-livedata/remote_collection_driver.js @@ -1,6 +1,7 @@ -MongoInternals.RemoteCollectionDriver = function (mongo_url) { +MongoInternals.RemoteCollectionDriver = function ( + mongo_url, options) { var self = this; - self.mongo = new MongoConnection(mongo_url); + self.mongo = new MongoConnection(mongo_url, options); }; _.extend(MongoInternals.RemoteCollectionDriver.prototype, { @@ -32,5 +33,11 @@ MongoInternals.defaultRemoteCollectionDriver = _.once(function () { if (! mongoUrl) throw new Error("MONGO_URL must be set in environment"); - return new MongoInternals.RemoteCollectionDriver(mongoUrl); + var connectionOptions = {}; + // XXX we should NOT be reading directly from the env here; need to consult + // with naomi re: AppConfig + if (process.env.XXX_OPLOG_URL) + connectionOptions.oplogUrl = process.env.XXX_OPLOG_URL; + + return new MongoInternals.RemoteCollectionDriver(mongoUrl, connectionOptions); });