From dc4c004e08eabfd39d5a0b32248c8067d8e7cf77 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Wed, 23 Sep 2020 10:54:07 -0400 Subject: [PATCH 1/2] disableMongo configuration for Vent-only mode --- README.md | 1 + lib/config.js | 2 +- lib/init.js | 4 +++- testing/boot.js | 1 - 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 25d8082f..801851c0 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Configure it via Meteor settings: "pushToRedis": true // Pushes to redis the changes by default }, "debug": false, // Will show timestamp and activity of redis-oplog. + "disableMongo": false // Set to true to disable redis-oplog's Mongo functionality. Useful if you just want to use Vent. } } ``` diff --git a/lib/config.js b/lib/config.js index dbcf4765..f6c26378 100644 --- a/lib/config.js +++ b/lib/config.js @@ -4,7 +4,7 @@ let Config = { isInitialized: false, debug: false, - overridePublishFunction: true, + disableMongo: false, mutationDefaults: { pushToRedis: true, optimistic: true, diff --git a/lib/init.js b/lib/init.js index 43122673..0442d492 100644 --- a/lib/init.js +++ b/lib/init.js @@ -23,7 +23,9 @@ export default (config = {}) => { oldPublish: Meteor.publish, }); - extendMongoCollection(); + if (!Config.disableMongo) { + extendMongoCollection(); + } // this initializes the listener singleton with the proper onConnect functionality getRedisListener({ diff --git a/testing/boot.js b/testing/boot.js index d6b70de5..a61868d6 100644 --- a/testing/boot.js +++ b/testing/boot.js @@ -8,7 +8,6 @@ if (Meteor.isServer) { port: 6379, // Redis port host: '127.0.0.1', // Redis host }, - // overridePublishFunction: true // debug: true }); } From ce236e8d6691231942464cf3523cf25c91b6ccc6 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Fri, 25 Sep 2020 16:53:28 -0400 Subject: [PATCH 2/2] Switch to extendMongoCollection, add docs --- README.md | 2 +- docs/vent.md | 16 ++++++++++++++++ lib/config.js | 2 +- lib/init.js | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 801851c0..c924cb06 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Configure it via Meteor settings: "pushToRedis": true // Pushes to redis the changes by default }, "debug": false, // Will show timestamp and activity of redis-oplog. - "disableMongo": false // Set to true to disable redis-oplog's Mongo functionality. Useful if you just want to use Vent. + "extendMongoCollection": true // Set to false to leave Mongo.Collection as is without redis-oplog functionality. Useful if you just want to use Vent. } } ``` diff --git a/docs/vent.md b/docs/vent.md index 6286ffa8..58a76697 100644 --- a/docs/vent.md +++ b/docs/vent.md @@ -146,3 +146,19 @@ Initially the server will send an .added event with an `_id: 'id'`, then the eve We don't create any LocalCollection per subscription, as you expect, because it hooks into all the messages incomming from DDP, does a quick check to see if it's a `vent` and calls the attached listener. + +### Vent-only support + +If you *only* want to use Vent from redis-oplog (and don't want +`Mongo.Collection` operations to automatically send Redis messages), +set the following in your `settings.json`: + +```json +{ + ... + "redisOplog": { + ... + extendMongoCollection: false + } +} +``` diff --git a/lib/config.js b/lib/config.js index f6c26378..82991cb1 100644 --- a/lib/config.js +++ b/lib/config.js @@ -4,7 +4,7 @@ let Config = { isInitialized: false, debug: false, - disableMongo: false, + extendMongoCollection: true, mutationDefaults: { pushToRedis: true, optimistic: true, diff --git a/lib/init.js b/lib/init.js index 0442d492..542f5ac3 100644 --- a/lib/init.js +++ b/lib/init.js @@ -23,7 +23,7 @@ export default (config = {}) => { oldPublish: Meteor.publish, }); - if (!Config.disableMongo) { + if (Config.extendMongoCollection) { extendMongoCollection(); }