Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5366

#upsert misuses #update_one

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 7.4.1, 7.3.5
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible

      Mongoid's #upsert method misuses the driver's #update_one method, because Mongoid actually provides a replacement document hence should use #replace_one, not #update_one. This was flagged by the change in https://jira.mongodb.org/browse/RUBY-2996.

      This change should be backported as far back as is practical (for example through 7.3) so that when driver 2.18 is released with a warning for https://jira.mongodb.org/browse/RUBY-2996, users can update their Mongoid versions within each minor release to not have Mongoid-originated warnings.

      Note that this ticket does not change behavior - Mongoid will use continue performing a replacing upsert and but will do it correctly via replace_one instead of incorrectly via update_one. Changing to an updating upsert is covered by https://jira.mongodb.org/browse/MONGOID-5363.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: