Say I have a field value saved like this:
[
{
shop: {
id: '63bb051e53c9a3b0f68c4a16',
name: 'Amazon',
createdAt: '2023-01-08T18:02:06.334Z',
updatedAt: '2023-01-08T18:02:06.334Z'
},
link: 'https://www.amazon.ca/Sony-Alpha-A6400-Mirrorless-Camera/dp/B07MV3P7M8',
link_affiliate: 'https://www.amazon.ca/Sony-Alpha-A6400-Mirrorless-Camera/dp/B07MV3P7M8',
available: true,
id: '63dbb707c766bf2123681699',
price: 191.59,
last_checked: 'Thu Mar 16 2023 15:52:48 GMT+0100 (Central European Standard Time)'
}
]```
I'd like to use it in a payload.update, but get the error "This field has the following invalid selections for the "shop" field.
I think instead of
shop: {
id: '63bb051e53c9a3b0f68c4a16',
name: 'Amazon',
createdAt: '2023-01-08T18:02:06.334Z',
updatedAt: '2023-01-08T18:02:06.334Z'
}
you'd need shop: '63bb051e53c9a3b0f68c4a16',
Is there a function to automatically flatten that?