Search.../

removeReference( )

Removes a reference from the specified property.

Description

The removeReference() function returns a Promise that resolves when a reference to the referenced item(s) is removed from the specified property in the referring item. The Promise is rejected if the current user does not have update permissions for the collection.

Calling the removeReference() function does not trigger any hooks.

Note: The removeReference() function is not supported for Single Item Collections.

Authorization

Request

This endpoint does not take any parameters

Response Object

Fulfilled - When the references have been removed. Rejected - The error that caused the rejection.

Returns an empty object.

Status/Error Codes

Was this helpful?

Remove a reference

This example removes a reference to the item with ID 12345 from the Actors field of the item in the Movies collection with the ID 00001.

Copy Code
1import wixData from 'wix-data';
2
3// ...
4
5wixData.removeReference("movies", "actors", "00001", "12345")
6 .then(() => {
7 console.log("Reference removed");
8 })
9 .catch((error) => {
10 console.log(error);
11 });
12
Remove references using an array

This example removes a reference to the items with IDs 12345 and 67890 from the Actors field of the item in the Movies collection with the ID 00001.

Copy Code
1import wixData from 'wix-data';
2
3// ...
4
5wixData.removeReference("movies", "actors", "00001", ["12345", "67890"])
6 .then(() => {
7 console.log("Reference removed");
8 })
9 .catch((error) => {
10 console.log(error);
11 });
12