Skip to content

Commit 8a9c638

Browse files
p-mongop
andauthored
MONGOID-5363 Document that upsert replaces existing documents (#5293)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent b43b388 commit 8a9c638

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/reference/crud.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ operations with examples.
191191

192192
* - ``Model#upsert``
193193

194-
*Performs a MongoDB upsert on the document. If the document exists in the database,
195-
it will get overwritten with the current attributes of the document in memory.
196-
If the document does not exist in the database, it will be inserted. Note that
197-
this only runs the* ``{before|after|around}_upsert`` *callbacks.*
194+
*Performs a MongoDB replace with upsert on the document. If the document
195+
exists in the database, it will get overwritten with the current
196+
document in the application (any attributes present in the database but
197+
not in the application's document instance will be lost).
198+
If the document does not exist in the database, it will be inserted.
199+
Note that this only runs the* ``{before|after|around}_upsert`` *callbacks.*
198200
-
199201
.. code-block:: ruby
200202

0 commit comments

Comments
 (0)