[bug] update_all does not map :as option of the field properly #5666
Closed
midnight-wonderer
started this conversation in
General
Replies: 2 comments
-
Thanks for the bug report! I've been looking into this one, and I might have a solution soon (need to discuss it with the team). You can follow the ticket here: https://jira.mongodb.org/browse/MONGOID-5632. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@midnight-wonderer just to close the loop on this discussion, the issue you described was fixed in Mongoid 8.0.6 and 8.1.2. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there
This is a bug report; please bear with me.
Scenario
Supposed we have a simple model with as-option-set fields:
I created one document in the collection:
Then update the document:
What result do you expect from the following code?
[2, 2]
? like me?Nope, the current Mongoid returns
[1, 1]
.Why?
Because
update_all
does not map the field name withBuggyModel.aliased_fields
properly.That's the problem.
Supporting rationales
You may argue that this is working as intended.
Here is my argument against that hypothetical argument.
Aliased fields work inside criteria:
Fields with custom serializers work with
update_all
:I can't think of a plausible explanation for why this should not work:
What do you guys say?
Beta Was this translation helpful? Give feedback.
All reactions