Updates an item in a collection.
update() function returns a Promise that resolves to the updated
item from the specified collection. The Promise is rejected if the
current user does not have update permissions for the collection.
update() function compares the
_id property of the specified
item with the
_id property values of the items in the specified
collection. If an item in the collection has that
replaced the item's property values with the ones in the specified item.
If the existing item had properties with values and those properties were not
included in the specified item, the values in those properties are lost. The
_updatedDate property is also updated to the current date.
function maintains the structure of the specified object. For example,
objects that contain nested objects, Arrays, or Arrays with nested objects
are all added to the collection as defined.
options parameter to run
update() from backend code without
checking for permissions or without its registered hooks.
When updating an item in a collection that has a reference field, set
the value of the reference field to the referenced item's
_id value or
the entire referenced item object.
The maximum size of an item that you can update in a collection is 200kb.
function update(collectionName: string, item: Object, [options: WixDataOptions]): Promise<Object>
The name of the collection that contains the item to update.
The item to update.
An object with one or both of the following boolean properties: suppressAuth, suppressHooks.
Fulfilled - The object that was updated. Rejected - The error that caused the rejection.
Was this helpful?