Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mongoize update all array operators 8.1 #5824

Open
wants to merge 2 commits into
base: 8.1-stable
Choose a base branch
from

Conversation

JohnMaguir
Copy link
Contributor

@@ -198,7 +198,7 @@ def to_criteria
def value_for(operator, klass, key, value)
case operator
when "$rename" then value.to_s
when "$addToSet", "$push" then value.mongoize
when "$addToSet", "$push", '$pull', '$pop' then value.mongoize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$pullAll?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @johnnyshields. I looked close at this exact question when I was evaluating these PRs, and it's not necessary to specify $pullAll here. In the case of $push, $pull, etc, the value of the operation may different than the declared value of the field itself (because the field is array-valued), and so must be handled specially. For $pullAll, the value is an array, for an array-valued field, and so it is handled fine by the default case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants