I've been working on a calorie counter and I'm slowly making progress on my MQL write. The issue that I'm having currently is updating the recipe itself which is in the /common/topic/description
property.
The query that I am using currently is:
[{
id: recipeId, // previously retrieved
'/common/topic/description': {
connect: 'replace',
value: $('#description textarea').val(),
lang: '/lang/en'
}
}]
This succeeds in executing, but when I query (another) after it has run I get an error:
{
"domain": "global",
"reason": "invalid",
"message": "Unique query may have at most one result. Got 2",
"locationType": "other",
"location": "/common/topic/description"
}
According to the documentation, connect: replace
does an update on unique properties and an insert on non-unique ones. So am I getting that because a value was inserted?
Is it necessary to remove the other value to prevent the error? Do I need to know the existing value in order to remove it?
{
id: recipeId,
'/common/topic/description': {
connect: 'delete',
value: 'Value currently stored',
lang: '/lang/en'
}
}