Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2928

Implement BSON::Decimal128 comparison operators

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • bson-4.15.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      With BSON::Decimal128 used for storage of BigDecimals in Mongoid, there is a test failure due to .sort attempting to compare Decimal128 instances:

        1) Mongoid::Contextual::Mongo#distinct when providing a demongoizable field when legacy_pluck_distinct is set returns the non-demongoized distinct field values
           Failure/Error: expect(context.distinct(:sales).sort).to eq([ "1E2", "2E3" ])
           
           ArgumentError:
             comparison of BSON::Decimal128 with BSON::Decimal128 failed
           # ./spec/mongoid/contextual/mongo_spec.rb:563:in `sort'
           # ./spec/mongoid/contextual/mongo_spec.rb:563:in `block (5 levels) in <top (required)>'
           # ./spec/support/macros.rb:26:in `block in config_override'
      

      BSON::Decimal128 should implement comparison operators against other Decimal128 instances, Integers, Floats and BigDecimals.

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

              Created:
              Updated:
              Resolved: