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

upsert option is not sent to legacy servers with w:0 due to string/symbol key mismatch

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.11.3, 2.10.4, 2.12.0.rc0
    • Affects Version/s: 2.10.3, 2.11.2
    • Component/s: None
    • None
    • Fully Compatible

      Upon upgrading to v2.11.2 of the `mongo` gem, our software's uses of `upsert: true` failed to insert new documents. Example:

       

      collection.find.count # => 0
      collection.find(_id: BSON::ObjectId('5dfa8ad7ea64ae457941102b')).update_one({'$set' => {foo: 'bar'}}, upsert: true) # => 
      #<Mongo::Operation::Update::Legacy::Result:0x70339487480360 documents=[]>
      collection.find.count # => 0

       
       
      What we expect to happen is for a new document with keys _id and foo to be inserted.
       
      What actually happens is no document is inserted.
       
      Downgrading to v2.9.x fixes this problem. It appears related to a mismatch of symbol vs. string "upsert" keys in https://github.com/mongodb/mongo-ruby-driver/pull/1439 (https://jira.mongodb.org/browse/RUBY-1878).
       

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            it@artsymail.com Joe IT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: