Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5332

Comprehensive mongoization/demongoization/evolution of all types

    • Type: Icon: Epic Epic
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Done
    • Comprehensive mongoization/demongoization/evolution (comp)
    • 6
    • 5
    • 5
    • 100
    • Hide

      Target End Date: Setting to Closed

      Engineer(s):  Neil Shweky

      Status update:

      • Neil has completed this epic
      • Tech Design for the Attribute Storage Refactoring is Pending LGTM, moving that WRITING ticket to that epic and closing this one

      Rationale for delays:

      • N/A

      Risks:

      • N/A

      Target End Date: 2022-08-05

      Engineer(s):  Neil Shweky

      Status update:

      • Neil has been making great progress on this - no change to target date

      Rationale for delays:

      • N/A

      Risks:

      • N/A

      Target End Date: 2022-08-05

      Engineer(s):  Neil Shweky

      Status update:

      • Neil has begun implementation this past week- now in Progress

      Rationale for delays:

      •  

      Risks:

      •  
      Show
      Target End Date: Setting to Closed Engineer(s):  Neil Shweky Status update: Neil has completed this epic Tech Design for the Attribute Storage Refactoring is Pending LGTM, moving that WRITING ticket to that epic and closing this one Rationale for delays: N/A Risks: N/A Target End Date: 2022-08-05 Engineer(s):  Neil Shweky Status update: Neil has been making great progress on this - no change to target date Rationale for delays: N/A Risks: N/A Target End Date: 2022-08-05 Engineer(s):  Neil Shweky Status update: Neil has begun implementation this past week- now in Progress Rationale for delays:   Risks:  

      Summary

      Mongoid allows applications to define field types for their fields. Subsequently there are several operations that convert values to these types from other types:

      • mongoization: when storing a value in a model instance
      • evolution: when storing a value in a Criteria object for a query
      • demongoization: when reading a value from the database and writing to model attributes

      In all of these operations, the input value can generally be of any type. Because of this the actual conversion logic is non-trivial and several of the cases have been reported to not work correctly.

      The scope of this epic is a thorough review of the behavior in question for all possible inputs and repair of any incorrect behavior.

      Changes

      • Populate attributes_before_type_cast on read from database - MONGOID-5404. This will provide a place to store incoming values when they cannot be mongoized or demongoized. (The storage is already done for mongoization, the change is to also add it for demongoization)
      • Always mongoize uncastable values to nil - MONGOID-5222 . This will address inconsistent mongoization. Unlike ActiveRecord we will no longer sometimes convert uncastable values to default values for the desired type, or perform conversions of partial input.
      • Always demongoize uncastable values to nil - MONGOID-5221 . This will address inconsistent demongoization. Just like with mongoization, we will no longer replace uncastable values with default values and we will not convert partial input. Population of attributes_before_type_cast is the required prerequisite for this change.
      • Pass through uncastable values in evolve - MONGOID-5386 . For evolution, we can send any value in a query to the server, and this behavior makes sense therefore uncastable values will be forwarded as they are.

      Motivation

      Who is the affected end user?

      Who are the stakeholders?

      How does this affect the end user?

      Are they blocked? Are they annoyed? Are they confused?

      How likely is it that this problem or use case will occur?

      Main path? Edge case?

      If the problem does occur, what are the consequences and how severe are they?

      Minor annoyance at a log message? Performance concern? Outage/unavailability? Failover can't complete?

      Is this issue urgent?

      Does this ticket have a required timeline? What is it?

      Is this ticket required by a downstream team?

      Needed by e.g. Atlas, Shell, Compass?

      Is this ticket only for tests?

      Is this ticket have any functional impact, or is it just test improvements?

      Cast of Characters

      Engineering Lead:
      Document Author:
      POCers:
      Product Owner:
      Program Manager:
      Stakeholders:

      Channels & Docs

      Slack Channel

      [Scope Document|some.url]

      [Technical Design Document|some.url]

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              6 weeks