-
Type: Task
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Server
-
Labels:None
The findAndModify() documentation reads, on the upsert option:
When true, findAndModify() creates a new document if no document matches the query, or if documents match the query, findAndModify() performs an update. To avoid multiple upserts, ensure that the query fields are uniquely indexed.
IIUC, replaceOne has the same behavior, but we don't warn about the need for unique indexes when upsert is set to true.
This ticket is to suggest adding the quoted paragraph above to the replaceOne() documentation.
- is related to
-
SERVER-22607 Duplicate key error on replace with upsert
- Closed