Skip to content

Commit

Permalink
Fix override
Browse files Browse the repository at this point in the history
  • Loading branch information
jdgjsag67251 committed Apr 10, 2024
1 parent 051591f commit 24abd09
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/cache/ObservableCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class ObservableCollection {
);
}

this.cursor = this.collection.find(
this.cursor = this.collection._redisOplogCollectionMethods.find(
cursorDescription.selector,
cursorDescription.options
);
Expand Down Expand Up @@ -155,7 +155,7 @@ export default class ObservableCollection {
*/
isEligibleByDB(_id) {
if (this.matcher) {
return !!this.collection.findOne(
return !!this.collection._redisOplogCollectionMethods.findOne(
Object.assign({}, this.selector, { _id }),
{ fields: { _id: 1 } }
);
Expand Down Expand Up @@ -214,7 +214,7 @@ export default class ObservableCollection {
*/
addById(docId) {
const { limit, skip, ...cleanedOptions } = this.options;
const doc = this.collection.findOne({ _id: docId }, cleanedOptions);
const doc = this.collection._redisOplogCollectionMethods.findOne({ _id: docId }, cleanedOptions);

this.store.set(docId, doc);

Expand Down
6 changes: 2 additions & 4 deletions lib/mongo/mongoCollectionNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const constructor = Mongo.Collection;
const proto = Mongo.Collection.prototype;

const hook = function() {
let ret = constructor.apply(this, arguments);
const ret = constructor.apply(this, arguments);
map[arguments[0]] = this;
return ret;
};
Expand All @@ -17,9 +17,7 @@ hook.__getCollectionByName = function (name) {
const collection = map[name];

// Use 'direct', if available, to skip all collection hooks
if (collection.direct) {
Object.assign(collection, collection.direct);
}
collection._redisOplogCollectionMethods = collection.direct ?? collection;

return collection;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/processors/actions/requery.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function (observableCollection, newcomer, event, modifiedFields)
const { store, selector, options } = observableCollection;

const newStore = new MongoIDMap();
const freshIds = observableCollection.collection.find(selector, { ...options, fields: { _id: 1 } }).fetch();
const freshIds = observableCollection.collection._redisOplogCollectionMethods.find(selector, { ...options, fields: { _id: 1 } }).fetch();
freshIds.forEach((doc) => newStore.set(doc._id, doc));

let added = false;
Expand Down
4 changes: 2 additions & 2 deletions lib/redis/RedisSubscriptionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ class RedisSubscriptionManager {
const fieldsOfInterest = getFieldsOfInterestFromAll(subscribers);

if (fieldsOfInterest === true) {
doc = collection.findOne(doc._id);
doc = collection._redisOplogCollectionMethods.findOne(doc._id);
} else {
doc = collection.findOne(doc._id, { fields: fieldsOfInterest });
doc = collection._redisOplogCollectionMethods.findOne(doc._id, { fields: fieldsOfInterest });
}

return doc;
Expand Down

0 comments on commit 24abd09

Please sign in to comment.