File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -572,3 +572,11 @@ inside a hash. For example:
572572
573573 In Mongoid 8.0, the default value of the ``Mongoid.legacy_pluck_distinct`` option will
574574 change to ``false``.
575+
576+
577+ ``update_one`` Warnings in ``upsert``
578+ -------------------------------------
579+
580+ Mongoid 7.4.1 fixes incorrect usage of the driver's ``update_one`` method from
581+ Mongoid's ``upsert`` method. Mongoid's ``upsert`` actually performs a
582+ replacing upsert, and Mongoid 7.4.1 and later correctly call ``replace_one``.
Original file line number Diff line number Diff line change @@ -80,3 +80,10 @@ The following functions are affected by this change:
8080 the selector can be strings or symbols, depending on what was passed to the
8181 operator.
8282
83+
84+ ``update_one`` Warnings in ``upsert``
85+ -------------------------------------
86+
87+ Mongoid 7.5 fixes incorrect usage of the driver's ``update_one`` method from
88+ Mongoid's ``upsert`` method. Mongoid's ``upsert`` actually performs a
89+ replacing upsert, and Mongoid 7.5 correctly calls ``replace_one``.
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ module Upsertable
1818 # @return [ true ] True.
1919 def upsert ( options = { } )
2020 prepare_upsert ( options ) do
21- collection . find ( atomic_selector ) . update_one (
21+ collection . find ( atomic_selector ) . replace_one (
2222 as_attributes , upsert : true , session : _session )
2323 end
2424 end
You can’t perform that action at this time.
0 commit comments