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

Move field type protocol to dedicated classes

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Currently the field type protocol is implemented on the value classes themselves. This is problematic because it requires modification of standard library classes by Mongoid and it may require modification of third-party classes by applications (if an application wants to store values of a class defined by a library).

      Instead of being implemented on the value classes, the field type protocol can be moved to dedicated classes. For example, we would define a new class, Mongoid::Fields::FieldTypes::Integer, which would implement the 4 required methods (typecast, mongoize, demongoize, evolve) for converting ::Integer values.

      This ticket is similar to https://jira.mongodb.org/browse/MONGOID-5210 but focuses on actual implementation of type conversions, whereas https://jira.mongodb.org/browse/MONGOID-5210 changed the API while still keeping the logic on user classes.

            Assignee:
            Unassigned Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: