Patch Operation
← Back to DP-420 Terminology Reference
Category: Client Connectivity & SDK
Summary: Partial update of specific item properties without replacing the whole document.
Overview
A patch operation allows partial updates to specific properties of an item without replacing the entire document, using JSON Patch-style operations (such as add, set, replace, remove, and increment). Patch operations are more RU-efficient and reduce the risk of overwriting concurrent changes to unrelated properties, compared to reading, modifying, and replacing an entire item.
More Info & Links
DP-420 Style Practice Questions
Q1. What is the main benefit of using a patch operation instead of a full item replace?
- A. It updates only specific properties, reducing RU cost and the risk of overwriting unrelated concurrent changes
- B. It automatically re-indexes the entire container
- C. It bypasses the need for a partition key
- D. It guarantees strong consistency regardless of account settings
Q2. Which of these is a supported patch operation type?
- A. Increment a numeric property
- B. Change the container's partition key
- C. Change the account's consistency level
- D. Rename the container
Answer Key
Answers are listed at the very end so you can attempt the questions first.
- Q1 (Patch Operation): A. It updates only specific properties, reducing RU cost and the risk of overwriting unrelated concurrent changes — Patch operations modify only the targeted properties, which is more efficient and safer for concurrent updates than a full replace.
- Q2 (Patch Operation): A. Increment a numeric property — Patch supports operations like add, set, replace, remove, and increment on individual item properties.
DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB — term detail page