$merge execution always uses update when insert may be more efficient

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In scenarios where `$merge` specifies `whenNotMatched: "insert"` we could use insert path with catching duplicate error when the `whenMatched: "fail"` is specified and ignoring duplicate errors when `whenMatched:"keepExisting"` is specified.  Apparently we use updates with `upsert` in both cases which is less performant and cannot be batched into a single `insertMany`.

            Assignee:
            Unassigned
            Reporter:
            Asya Kamsky
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: