-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MONGOID-5408 .evolve should support wrapper class #5448
MONGOID-5408 .evolve should support wrapper class #5448
Conversation
@p-mongo this is ready for initial review. |
Hi @johnnyshields , thank you for the PR. Can you explain why you are evolving raw values? The ticket says to skip evolution when querying, this is opposite behavior. |
@p-mongo we still need to evolve Ruby classes into Mongo driver-compatible ones, e.g. BigDecimal into BSON::Decimal128. Otherwise, the driver won't be able to handle it AFAIK. The evolution in this case ignores any field type definition, and instead evolves purely using the value's class. |
The ticket is to not perform evolution. If you have a use case where evolution is required, please create a new ticket describing it. |
Raised: MONGOID-5468 |
@p-mongo on this PR I'll remove the evolution logic for RawValues. Can be done as a separate ticket follow-up if needed pending discussion in MONGOID-5468 |
98eebc5
to
dd07d91
Compare
@p-mongo this is ready for another review. I've removed the raw value evolve logic which commented about. I have a few extra specs which I'll add once you approve the code structure here. |
a9277b7
to
19f97ec
Compare
2cfa478
to
483e8ad
Compare
@@ -245,6 +232,33 @@ Since `id` and `_id` fields are aliases, either one can be used for queries: | |||
# embedded: false> | |||
|
|||
|
|||
Embedded Documents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I copy-pasted the "Embedded Documents" section to be after "Fields" w/out edits to it, as I felt it made more sense order-wise vis-a-vis additions to Fields section in this PR.
@alexbevi please unmark this PR as "Blocked". It is ready for final review (I have addressed all earlier comments from MongoDB team.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, @johnnyshields! Just a couple of minor comments on things I wanted to clarify, but once those are answered I'm happy to approve this.
@@ -150,6 +150,8 @@ def evolve_multi(specs) | |||
# | |||
# @return [ Object ] The serialized object. | |||
def evolve(serializer, value) | |||
return value.raw_value if value.is_a?(Mongoid::RawValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @johnnyshields -- I hate to keep drawing this PR out, but I wanted to ask if there was a specific reason for using a guard here, rather than adding when Mongoid::RawValue
as a clause in the case
statement below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it. Good catch.
@jamis thanks for your review! Comments addressed. |
This is now possible: