Hi Meteorites,
I’ve been trying to update a nested array inside of a document, my update method looks like this:
updateLine: function (taskId, name) {
var setObj = {};
setObj.$set = {};
var key = 'line.' + index;
setObj.$set[key] = {
name: name
};
console.log(setObj);
tasks.update({_id: taskId}, setObj);
},
When I console.log the setObj, it looks like it’s supposed to, like this:
{'$set': {'line.0': {name: name}}
But it doesn’t actually update, nor am I getting errors. The only thing I can think of is that the quotes don’t look quite right ($set shouldn’t be in quotes). On the server it returns as above, on the client both $set and line.0 return without quotes.
I’ve been hitting my head against a wall for a while, here, I’m sure it’s something simple I’m overlooking.