mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Return a correct matching object from matchingDocument in the $eq case
For #4235. The previous version worked for most simple cases but was not actually correct. The idea is this function returns a "prototypical" document that can be tested by the oplog query -- this was returning `true` which tended to match but wasn't actually right.
This commit is contained in:
@@ -528,6 +528,7 @@ Tinytest.add("minimongo - sorter and projection combination", function (test) {
|
||||
// floating point math, the current implementation falls back to T
|
||||
T({ a: { $gt: 9.999999999999999, $lt: 10 }, x: 1 }, { $set: { x: 1 } }, "very close $gt and $lt");
|
||||
T({ a: { $eq: 5 } }, { $set: { a: 5 } }, "set of $eq");
|
||||
T({ a: { $eq: 5 }, b: { $eq: 7 } }, { $set: { a: 5 } }, "set of $eq with other $eq");
|
||||
F({ a: { $eq: 5 } }, { $set: { a: 4 } }, "set below of $eq");
|
||||
F({ a: { $eq: 5 } }, { $set: { a: 6 } }, "set above of $eq");
|
||||
T({ a: { $ne: 5 } }, { $unset: { a: 1 } }, "unset of $ne");
|
||||
@@ -568,4 +569,3 @@ Tinytest.add("minimongo - sorter and projection combination", function (test) {
|
||||
T({ a: { $ne: { a: 2 } } }, { $set: { a: { a: 2 } } }, "$ne object");
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
@@ -142,8 +142,7 @@ Minimongo.Matcher.prototype.matchingDocument = function () {
|
||||
// chance we can use one of those as "matching"
|
||||
// dummy value
|
||||
if (valueSelector.$eq) {
|
||||
var matcher = new Minimongo.Matcher({ placeholder: valueSelector });
|
||||
return matcher.documentMatches({ placeholder: valueSelector.$eq });
|
||||
return valueSelector.$eq;
|
||||
} else if (valueSelector.$in) {
|
||||
var matcher = new Minimongo.Matcher({ placeholder: valueSelector });
|
||||
|
||||
@@ -220,4 +219,3 @@ var startsWith = function(str, starts) {
|
||||
return str.length >= starts.length &&
|
||||
str.substring(0, starts.length) === starts;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user