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

Enhance replaceOne() documentation on upsert behavior

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 01112017-cleanup
    • None
    • Server
    • None

    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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 29 weeks, 5 days ago