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:
572
572
573
573
In Mongoid 8.0, the default value of the ``Mongoid.legacy_pluck_distinct`` option will
574
574
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:
80
80
the selector can be strings or symbols, depending on what was passed to the
81
81
operator.
82
82
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
18
18
# @return [ true ] True.
19
19
def upsert ( options = { } )
20
20
prepare_upsert ( options ) do
21
- collection . find ( atomic_selector ) . update_one (
21
+ collection . find ( atomic_selector ) . replace_one (
22
22
as_attributes , upsert : true , session : _session )
23
23
end
24
24
end
You can’t perform that action at this time.
0 commit comments