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

options.Update().SetUpsert(true) being reset after each collection.updateOne

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.1.4
    • Component/s: CRUD
    • Labels:
      None
    • Environment:
      Linux 4.9.0-11-amd64

      If I setup an opts variable, like this:

       

      ```

      opts := options.Update().SetUpsert(true)

      ```

       

      Then I run collection.updateOne using that opts variable, then try to run another collection.UpdateOne using that opts variable it gives an error which does not describe that the problem is that the upsert option is not set to true and there is no existing document that matches the filter,.

       

      If I just reset the opts variable after each collection.updateOne, like this:

       

      ```

      opts := options.Update().SetUpsert(true)

      ```

       

      Then it works as intended.  The error is ambiguous and I do not understand the reason that it would reset the options each time when the options are stored in a variable.

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrewhodel@gmail.com Andrew Hodel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: