Upsert document using UPSERT keyword
Same as upsert with INSERT and the Upsert option in WITH, but uses the UPSERT INTO syntax so you do not need the WITH clause. Use whichever style you prefer; behavior is the same.
UPSERT INTO TestContainer (PartitionKey, Document)
VALUES(
'["user2"]', --partition key value must match its attribute from document else it will throw error. In this example container PartitionKey is /id so we used its value. For multiple key use JSON array ["val1","val2"]
'{
"id": "user2",
"name": "John Doe",
"email": "jdoe@contoso.com",
"phone": ["12345"],
"level": "platinum"
}')