$merge execution uses update when insert may be more efficient

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2026-01-05, QE 2025-12-22
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In scenarios where `$merge` specifies `whenNotMatched: "insert"` `whenMatched:"keepExisting"` we could use insert path ignoring duplicate errors.  We use updates with `upsert` which is less performant and cannot be batched into a single `insertMany`.

      The `whenMatched: "fail"` `whenNotMatched: "insert"` path uses insert, but may not use `insertMany`.

            Assignee:
            Ivan Fefer
            Reporter:
            Asya Kamsky
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: