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

Support older driver versions for BSON deserialization

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: bson-4.8.1, bson-4.8.2
    • Component/s: BSON
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      In bson-4.8.0 the #from_bson method was changed to take **options. In older Ruby driver releases there is a DBRef class which has a #from_bson implementation that does not accept the **options, resulting in failures in Mongoid that look like the following:

      W, [2020-02-28T16:19:15.067868 #10134]  WARN -- : MONGODB | Failed to handshake with localhost:14420: ArgumentError: wrong number of arguments (given 2, expected 1):
      /home/w/.rbenv/versions/jruby-9.2.7.0/lib/ruby/gems/shared/gems/mongo-2.11.3/lib/mongo/dbref.rb:115:in `from_bson'
      /home/w/.rbenv/versions/jruby-9.2.7.0/lib/ruby/gems/shared/gems/bson-4.8.0-java/lib/bson/hash.rb:115:in `from_bson'
      /home/w/.rbenv/versions/jruby-9.2.7.0/lib/ruby/gems/shared/gems/mongo-2.11.3/lib/mongo/dbref.rb:104:in `from_bson'
      /home/w/.rbenv/versions/jruby-9.2.7.0/lib/ruby/gems/shared/gems/mongo-2.11.3/lib/mongo/protocol/serializers.rb:354:in `deserialize'
      /home/w/.rbenv/versions/jruby-9.2.7.0/lib/ruby/gems/shared/gems/mongo-2.11.3/lib/mongo/protocol/message.rb:306:in `block in deserialize_array'
      /home/w/.rbenv/versions/jruby-9.2.7.0/lib/ruby/gems/shared/gems/mongo-2.11.3/lib/mongo/protocol/message.rb:306:in `deserialize_array'
      

      The call to #from_bson needs to check for options being empty and omit the **options in that case.

        Attachments

          Activity

            People

            Assignee:
            oleg.pudeyev Oleg Pudeyev
            Reporter:
            oleg.pudeyev Oleg Pudeyev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: