WL#11434: X Protocol Crud.Insert with upsert, behavior redefined

Affects: Server-8.0   —   Status: Complete

Motivation

WL#9807 introduces an "upsert" (insert-or-update) functionality for Documents.

Following functional requirement of WL#9807:

FR2 - When an upsert leads to an Update, the primary key of the original item must be preserved

which leads to the upserted document to loose its document-id:

Given collection contains unique-index on field "name"
  And collection contains a document with { _id = "a", name = "foo", city = "Rome" }
 When user sends insert-or-update { _id = "b", name = "foo", city = "Rio" }
 Then ...

Expected result:

Insert document "b" and Error (unique-key violation on "name")

Current result:

Update document "a": _id = "a" (or "b"), name = "foo", city = "Rio"

Goal

Redefine the functional requirements in a way that upsert triggered by secondary key causes error when primary keys of both documents doesn't match.