This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Refines a patch operation to remove the first instance of the specified value from the specified array field.
function removeFromArray(field: string, value: any): WixDataPatch;
Array field to remove the specified value from. Nested fields can be specified using dot notation. For example: address.street
.
Value whose first instance is removed from the specified array field.
import { items } from "@wix/data";
async function removeFromArray() {
const updatedItem = await items
.patch("BlogPosts", "fb071093-9a40-432d-ae1f-2e5966fecbfa")
.removeFromArray("tags", "travel")
.run();
const id = updatedItem._id; // "fb071093-9a40-432d-ae1f-2e5966fecbfa"
const tags = updatedItem.tags; // ["vacations", "lifestyle"]
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.