Replies: 1 comment
-
Hi @sosolidkk , thank you for reporting the issue. I created JIRA ticker - https://jira.mongodb.org/browse/MONGOID-5849 - to track future work on this. |
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
-
Hey everyone,
I encountered what I believe is an unexpected behavior in Mongoid when using default values for fields. I couldn’t find any mention of this in the documentation, so I’m reporting it here to confirm whether this is the intended behavior. If it is, could you point me to where this happens in the code and explain the reasoning behind it?
Issue
When a field has a default value, Mongoid incorrectly flags it as changed (dirty), even if the value was not explicitly modified by the user.
Example Scenario
Consider the following model:
Now, when instantiating a new object:
Expected Behavior
Fields with default values should not be marked as changed unless explicitly modified by the user.
foo_changed?
should returnfalse
unlessfoo
was explicitly set to a different value.Current versions
Beta Was this translation helpful? Give feedback.
All reactions