[DOCS-7904] Enhance replaceOne() documentation on upsert behavior Created: 18/May/16  Updated: 11/Jan/17  Resolved: 22/Jul/16

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Improvement Priority: Minor - P4
Reporter: Ramon Fernandez Marina Assignee: Jonathan DeStefano
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-22607 Duplicate key error on replace with u... Closed
Participants:
Days since reply: 7 years, 29 weeks, 5 days ago

 Description   

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.



 Comments   
Comment by Githook User [ 22/Jul/16 ]

Author:

{u'username': u'jdestefano-mongo', u'name': u'jonathan', u'email': u'jonathan.destefano@10gen.com'}

Message: DOCS-7904 Added unique index warning on method pages with upsert parameter. Reworked update method w/ upsert pages. -JD

Signed-off-by: kay <kay.kim@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/d32fbc488c33b82f37eb1cd1b2fbbd82549c743e

Generated at Thu Feb 08 07:55:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.