As Wix Support does not handle questions related to Wix Code, I will post this here and hope for a quick response from the moderators.
Could you please confirm whether or not bulkInsert(), bulkSave(), or bulkUpdate will handle multi-item reference fields? The API documentation is not clear. Based upon my past experience, I would assume that while single item reference fields will be handled properly, multi-item reference fields will need to be handled separately using the insertReference() and replaceReference() API calls. In that correct?
It must be a type of array, for example:
let toInsert = {
title: 'John Doe',
name: 'John',
lastName: 'Doe',
References: [id1,id2,id3,id4,id5]
}
For me doesn’t work.
With my following code the ‘title’ property is correctly updated but the multi-reference field ‘tag’ no.
export async function button7_click(event) {
let id1 = 'b4d0f567-d370-46bb-9a7f-9b383065bd3e'
let id2 = '635c6630-5c96-454f-8b38-32336fe2b765'
let toUpdate = [
{
_id: '7d9cbc8e-86bb-45d7-9485-9fa3805a84e1',
title: 'testBulk 2',
tag: [id1,id2]
}
]
await wixData.bulkUpdate("productData", toUpdate)
.then( (results) => {
console.log('update results: ', results)
} )
.catch( (err) => {
console.log(err)
} );
}