Skip to content
Snippets Groups Projects
Unverified Commit 95139ac8 authored by gabriellsh's avatar gabriellsh Committed by GitHub
Browse files

regression: Minimongo queries with operator matching only first found _id (#33848)

parent 7c45f830
No related branches found
No related tags found
No related merge requests found
// TODO: Remove this after meteor fixes the issue
// This override fixes a recent issue introduced after the update to Meteor 3.0
// MinimongoCollection.remove(query) where `query` has `_id: { $in: Array }` removes only the first found record.
LocalCollection.prototype['_eachPossiblyMatchingDocAsync'] = async function (selector, fn) {
const specificIds = LocalCollection._idsMatchedBySelector(selector);
if (specificIds) {
for (const id of specificIds) {
const doc = this._docs.get(id);
if (doc && (await fn(doc, id)) === false) { // Changed from `!fn(doc,id)`
break
}
}
} else {
await this._docs.forEachAsync(fn);
}
}
LocalCollection.prototype['_eachPossiblyMatchingDocSync'] = function (selector, fn) {
const specificIds = LocalCollection._idsMatchedBySelector(selector);
if (specificIds) {
for (const id of specificIds) {
const doc = this._docs.get(id);
if (doc && fn(doc, id) === false) { // Changed from `!fn(doc,id)`
break
}
}
} else {
this._docs.forEach(fn);
}
}
// This file overwrites the default metoer Mongo.Collection modifiers: "insert",
// "update", "remove"
//
......@@ -44,3 +79,5 @@ _.each(['insert', 'update', 'remove'], function (method) {
return _super.apply(self, args);
};
});
......@@ -14,6 +14,7 @@ Package.onUse(function (api) {
'underscore',
'mongo',
'ddp',
'minimongo',
// 'ddp-common',
// 'ddp-client'
]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment