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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.10.3, 2.11.2
    • Fix Version/s: 2.11.3, 2.10.4, 2.12.0.rc0
    • Component/s: None
    • Labels:
      None

      Description

      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).
       

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: