mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
warning for subscriptions on excluded or not included collections
This commit is contained in:
@@ -995,6 +995,14 @@ Cursor.prototype.getTransform = function () {
|
||||
Cursor.prototype._publishCursor = function (sub) {
|
||||
var self = this;
|
||||
var collection = self._cursorDescription.collectionName;
|
||||
const oplogOptions = self?._mongo?._oplogHandle?._oplogOptions || {};
|
||||
const { includeCollections, excludeCollections } = oplogOptions;
|
||||
if (excludeCollections?.length && excludeCollections.includes(collection)) {
|
||||
console.warn(`Meteor.settings.packages.mongo.oplogExcludeCollections includes the collection ${collection} - no subscriptions/publications on this collection will return any updates`);
|
||||
}
|
||||
if (includeCollections?.length && !includeCollections.includes(collection)) {
|
||||
console.warn(`Meteor.settings.packages.mongo.oplogIncludeCollections does not include the collection ${collection} - no subscriptions/publications on this collection will return any updates`);
|
||||
}
|
||||
return Mongo.Collection._publishCursor(self, sub, collection);
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ OplogHandle = function (oplogUrl, dbName) {
|
||||
|
||||
self._oplogLastEntryConnection = null;
|
||||
self._oplogTailConnection = null;
|
||||
self._oplogOptions = null;
|
||||
self._stopped = false;
|
||||
self._tailHandle = null;
|
||||
self._readyFuture = new Future();
|
||||
@@ -263,6 +264,7 @@ Object.assign(OplogHandle.prototype, {
|
||||
$regex: oplogSelector.ns,
|
||||
$nin: excludeCollections.map((collName) => `${self._dbName}.${collName}`)
|
||||
}
|
||||
self._oplogOptions = { excludeCollections };
|
||||
}
|
||||
else if (includeCollections?.length) {
|
||||
oplogSelector = { $and: [
|
||||
@@ -273,6 +275,7 @@ Object.assign(OplogHandle.prototype, {
|
||||
{ $or: oplogSelector.$or }, // the initial $or to select only certain operations (op)
|
||||
{ ts: oplogSelector.ts }
|
||||
] };
|
||||
self._oplogOptions = { includeCollections };
|
||||
}
|
||||
|
||||
var cursorDescription = new CursorDescription(
|
||||
|
||||
Reference in New Issue
Block a user