# Can't update multi-reference field in Collection

**URL:** <https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [April 4, 2021, 11:48pm UTC](https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674 "2021-04-04T23:48:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesmrobertsonwork](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jamesmrobertsonwork/32/27604_2.png) [@jamesmrobertsonwork](https://forum.wixstudio.com/u/jamesmrobertsonwork)\
**Post date:** [April 4, 2021, 11:48pm UTC](https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674/1 "2021-04-04T23:48:54Z")

</div>

I’m trying to save an array of the referenced collection ids as strings for my multi-reference field, but when it saves, the field in the database is left empty

This is the code structure I am using. The field key is ‘sessions’ and it is set up as a multi-reference

```javascript

 console.log(sessions); // ['<id>','<id>']
 const camp = {
            '_id': campId,
            title: title.value,
            sessions: sessions,
        }
 await wixData.save('Camps', camp)
 .then(item => {
            console.log(item.sessions); //undefined
 );
   

```

Inside the ‘Camps’ collection:

![](https://us1.discourse-cdn.com/wix/original/3X/2/a/2aa2d5d82b773eaced4adac86f2c5476226b8980.png)

How am I supposed to update or save multi-reference fields for the collections? Are they not arrays of id strings as it says in the documentation?

---

<div class="post-metadata">

**Author:** ![tara](https://avatars.discourse-cdn.com/v4/letter/t/b4bc9f/32.png) [@tara](https://forum.wixstudio.com/u/tara)\
**Post date:** [June 7, 2022, 3:41pm UTC](https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674/2 "2022-06-07T15:41:32Z")

</div>

did you ever find an answer to this?

---

<div class="post-metadata">

**Author:** ![jamesmrobertsonwork](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jamesmrobertsonwork/32/27604_2.png) [@jamesmrobertsonwork](https://forum.wixstudio.com/u/jamesmrobertsonwork)\
**Post date:** [June 7, 2022, 6:28pm UTC](https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674/3 "2022-06-07T18:28:36Z")

</div>

No, I quit trying to use this api and approach since the mutli-reference never worked for me. Instead I just made the connections from the smaller items so I query for them etc. The multi-reference api was awful and I’d recommend ignoring it completely

Instead do it from one side. So for my example I had Camps that had multiple Camp Sessions, so instead of a multi-refrence in the Camps collection AND a camp reference in the Camp Sessions collection—I just have the later, and Camps themselves don’t have any lists of their connected items at all

Whenever I need a Camp Session I query for Camp Sessions who’s Camp reference is the Camp id I am looking for. This also works better for repeaters elements etc.

---

<div class="post-metadata">

**Author:** ![tara](https://avatars.discourse-cdn.com/v4/letter/t/b4bc9f/32.png) [@tara](https://forum.wixstudio.com/u/tara)\
**Post date:** [June 8, 2022, 12:32am UTC](https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674/4 "2022-06-08T00:32:24Z")

</div>

I am about to rip apart my design and do the same exact thing. Thanks for the quick reply 🙂

---

<div class="post-metadata">

**Author:** ![chuchomtz](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chuchomtz/32/37133_2.png) [@chuchomtz](https://forum.wixstudio.com/u/chuchomtz)\
**Post date:** [April 17, 2023, 7:49am UTC](https://forum.wixstudio.com/t/cant-update-multi-reference-field-in-collection/4674/5 "2023-04-17T07:49:58Z")

</div>

I used insertReference()…

**await** wixData . insertReference ( “Collection” , “ReferenceField” , itemId , referenceArray , options )
