> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: data.items.patch(dataCollectionId: string, itemId: string) # Method Link: https://dev.wix.com/docs/sdk/business-solutions/data/items/patch.md # Method Description: Creates a patch to modify the specified item. Unlike [`update()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/update.md), only the fields specified in the request are modified. Data that isn't explicitly modified remains unchanged. The `patch()` method builds a patch to modify a data item in a specified collection. It returns a `WixDataPatch` object that contains the patch definition, which you can further refine by chaining [`WixDataPatch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-patch/introduction.md) methods onto it. These methods allow you to clear, set, and increment field values, as well as add or remove items from array fields. The methods are applied in the order in which they are chained. Finally, to run the patch, chain [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-patch/run.md) as the last method. If an item is found in the specified collection with the specified ID, that item is patched. If the collection doesn't contain an item with that ID, the request fails. Calling the `patch()` method triggers the [`beforeUpdate()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-update.md) and [`afterUpdate()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-update.md) hooks, if they have been defined. > **Notes**: > - When an item is patched, its `data._updatedDate` property is updated to the current date and time. > - You can only patch items in [collections created by Wix users](https://support.wix.com/en/article/cms-formerly-content-manager-creating-a-collection). Items in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code.md) cannot be patched. # Method Permissions: - Write Data Items # Method Permissions Scopes IDs: - SCOPE.DC-DATA.WRITE # Method Code Examples: ## Patch an item in a collection ```javascript import { items } from "@wix/data"; async function patch() { const updatedItem = await items.patch("BlogPosts", "fb071093-9a40-432d-ae1f-2e5966fecbfa") .appendToArray("tags", "travel") .setField("published", true) .run() const id = updatedItem._id; // "fb071093-9a40-432d-ae1f-2e5966fecbfa" const tags = updatedItem.tags; // ["vacations", "travel"] const published = updatedItem.published; // true } ``` ## Patch an item in a collection with condition ```javascript import { items } from "@wix/data"; async function patch() { const filter = items.filter().eq("published", false); const updatedItem = await items.patch("BlogPosts", "fb071093-9a40-432d-ae1f-2e5966fecbfa") .appendToArray("tags", "travel") .setField("published", true) .run({ condition: filter }) const id = updatedItem._id; // "fb071093-9a40-432d-ae1f-2e5966fecbfa" const tags = updatedItem.tags; // ["vacations", "travel"] const published = updatedItem.published; // true } ``` ## default ```javascript try { const result = await items.patch("collection-0.40585083498947694", "6892593d-d57f-428d-bc53-3f0870a1beef"); return result; } catch (error) { console.error(error); throw error; } ```