Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1720

replace_one does not validate all keys for update operators

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      When using replace_one function, it only checks for the first argument to see if it is update operator or not. If first key is an update operator, it raises ValueError, whereas if it's after a valid key, it raises a WriteError from the server. This should be caught at the driver level instead of server level.

      Example - 

      col.replace_one({"name":"shrey"}, {"$set":{"hello":"world"}})
      

      The above line raises a ValueError, whereas the below line raises a WriteError

      col.replace_one({"name":"shrey"}, {"name": "name_1", "$set":{"hello":"world"}})
      

      Attachments

        Activity

          People

            divjot.arora@mongodb.com Divjot Arora (Inactive)
            shreybatra97@gmail.com Shrey Batra
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: