Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-7904

Enhance replaceOne() documentation on upsert behavior

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 01112017-cleanup
    • 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.

            Assignee:
            jonathan.destefano@mongodb.com Jonathan DeStefano
            Reporter:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              7 years, 41 weeks, 6 days ago