[bug?] fields in update_all did not get mongoized #5812
Replies: 3 comments
-
@midnight-wonderer we hit into this problem as well during our journey of mongoid upgrade :-) Custom type classes are not mongoized in update_all with $set operator. We have a solution: Currently we are using monkey patch on 8.1.5:
It solves problem for us (quite serious in terms of the app functionality). Hopefully it will help. And thanks for pointing to the line, which does not looks right:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for raising this discussion @midnight-wonderer, and for the PR @dem. Our team will have a look and circle back. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much. I've approved both PRs and am currently working through some infrastructure issues getting the 8.1-stable PR merged. Might have to wait until Monday for it. 👍 |
Beta Was this translation helpful? Give feedback.
-
I am using Mongoid 8.1.5.
By declaring the following document:
I expect
to produce
in the database.
Instead, it produces:
Not sure if this is intentional, but the "B" value doesn't get mongoized.
Also, unrelated to the bug, I audited some code there.
This line does not look right.
should be
it does not cause any bugs now, though.
But it might in the future.
If you happen to touch some code in that file, you might consider using The Boy Scout Rule to make an edit there also.
Beta Was this translation helpful? Give feedback.
All reactions