meteor-collection-hooks

meteor collection hooks updating element on a position in array

末鹿安然 提交于 2020-01-16 15:46:25
问题 i have this object: card: { customFields [ { id, value }, {id , value } ... ] } A customFields array is inside cards, which contans elements consisting of an id and a value. Now i want to update a certain element inside of the array, which can be done by doing something like this: modifier.$set.customFields.0.value = x but i have the number of the index only in a variable, so i tried: const index = getTargetIndex(); modifier.$set.customFields[index].value = x but it didn't work... What do i

meteor collection hooks updating element on a position in array

删除回忆录丶 提交于 2020-01-16 15:46:13
问题 i have this object: card: { customFields [ { id, value }, {id , value } ... ] } A customFields array is inside cards, which contans elements consisting of an id and a value. Now i want to update a certain element inside of the array, which can be done by doing something like this: modifier.$set.customFields.0.value = x but i have the number of the index only in a variable, so i tried: const index = getTargetIndex(); modifier.$set.customFields[index].value = x but it didn't work... What do i