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

Resolve Mongoid compatibility issues with bson-ruby deserializing decimal128 to BigDecimal

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 9.0.0
    • Affects Version/s: None
    • Component/s: None
    • None

      https://jira.mongodb.org/browse/RUBY-2867 changed bson-ruby to deserialize decimal128 to BigDecimal by default. This causes a compatibility issue with Mongoid in case a field is declared to be of BSON::Decimal128 type:

        field :foo, type: BSON::Decimal128
      

      In this case the application desires to not convert to BigDecimal (perhaps to preserve +/- NaNs), but bson-ruby would deserialize to BigDecimal anyway at which point Mongoid won't be able to preserve the value type as BSON::Decimal128.

      The proposed solution is to have Mongoid request that bson-ruby returns either decimal128 or all objects as their BSON types, and subsequently Mongoid will demongoize all of the types to their correct field types as declared by the application.

      After fixing this issue, we should enable MONGOID tests skipped for bson-master in this ticket - https://jira.mongodb.org/browse/MONGOID-4657

            Assignee:
            jamis.buck@mongodb.com Jamis Buck
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: