apostrophe-headless
apostrophe-headless copied to clipboard
Can append to nested array sub-properties, but we can't simply PATCH a sub-property value
Currently this works:
{
$push: {
'body.items.0.addresses': {
street: '500 Somewhere Lane'
}
}
}
But there is no way to just update the value of a subproperty, such as a string property, i.e. this does not yet work:
{
'body.items.0.addresses.0.street': '501 Somewhere Lane'
}
This isn't specific to updating properties within arrays, it's not supported at all except for updating a top level property as a whole.
A solution to this will appear in A3 work in progress soon, so hopefully can be borrowed here as well.
Actually it looks like dot notation probably doesn't really work for the special operators yet either. As written I think it would cause the loss of other properties higher up in the object. Messy.