> 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.insertReference(dataCollectionId: string, field: string, referringItem: any, referencedItem: any, options: WixDataOptions)

# Method Link:

https://dev.wix.com/docs/sdk/data-items-sdk/data/items/insert-reference.md

# Method Description:

Inserts a reference in the specified property.

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

> **Notes:**
> - The `insertReference()` method only applies to multi-reference fields.
> - The `insertReference()` method is not supported for Single Item
>   Collections.

# Method Permissions:

- Write Data Items

# Method Permissions Scopes IDs:

- SCOPE.DC-DATA.WRITE



# Method Code Examples:

## Insert a reference

```javascript
import { items } from "@wix/data";

async function insertReferencedItem() {
  await items.insertReference("movies", "actors", "00001", "12345");
  console.log("Reference inserted");
}

```



## Insert references using an array

```javascript
import { items } from "@wix/data";

async function insertReferencedItems() {
  await items.insertReference("movies", "actors", "00001", ["12345", "67890"]);
  console.log("Reference inserted");
}
```

## default

```javascript
try {
      const result = await items.insertReference(
          "collection-0.9044339111227744",
          "refs",
          "6892593d-d57f-428d-bc53-3f0870a1beef",
          ["1a1683ed-a07c-44dc-9cda-bbb4b97e5d8d"],
          {}
      );
      return result;
    } catch (error) {
      console.error(error);
      throw error;
   }
```