This is my schema:
{
_id: "FJwSEMdDriddXLKXh"
name: "t"
number: "5"
owners: [
{
_id: 1,
name: "Name",
address: "Address",
type: "Type",
gender: "Gender",
notes: []
}
]
}
and on click I would add fields inside owners nested notes array. This is my Meteor template events:
Template.owners.event({
'click #addNoteToOwner' : function(event, template){
event.preventDefault();
Territories.update({_id: template.data._id, owners: this._id}, {$push : {'owners.$.notes': {title:"First Title"}}})
}
})
If I try to update the doc, the following console errorT appear:
Uncaught Error: Not permitted. Untrusted code may only update documents by ID. [403]
Is my syntax correct? How can I update this nested array?
Thanks!