nickva commented on code in PR #6080:
URL: https://github.com/apache/couchdb/pull/6080#discussion_r4065515999
##########
src/mango/src/mango_selector.erl:
##########
@@ -299,9 +321,16 @@ norm_negations({[{<<"$or">>, Args}]}) ->
norm_negations({[{<<"$elemMatch">>, Arg}]}) ->
{[{<<"$elemMatch">>, norm_negations(Arg)}]};
norm_negations({[{<<"$allMatch">>, Arg}]}) ->
- {[{<<"$allMatch">>, norm_negations(Arg)}]};
+ Out = norm_negations(Arg),
+ {[{<<"$allMatch">>, Out}]};
norm_negations({[{<<"$keyMapMatch">>, Arg}]}) ->
{[{<<"$keyMapMatch">>, norm_negations(Arg)}]};
+% Sometimes a top-level key will be a doc field because it
+% can't be pushed down through its corresponding operator,
+% e.g. {x: {$allMatch: S}}. Negation inside the $allMatch
+% should still be normalized.
+norm_negations({[{Field, Cond}]}) when is_list(Field) ->
Review Comment:
Yeah it's a bug fix, definitely. I think it might affect for example a
partial index, if we skipped documents before and now they are added to the
index we'd get an inconsistent index. Before they excluded some docs now
they'll get extra. The same could be said about the a selector as a _changes
filter. There we would have skipped and not replicated some documents but now
it could be true so we'd allow extra documents through.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]