I have the following Document:
mainDoc = {
owner: Meteor.userId(),
createdOn: new Date(),
active: false,
label: "Dashboard #" + ($("ul#u-nav-tabs").find("li.u-tab").length + 1),
monitors: [/*Embedded documents*/],
sharewith: []
};
mainDoc.monitors
is an array of the following documents:
innerDoc = {
_id: id._str,
owner: Meteor.userId(),
createdOn: new Date(),
label: monitorLabel,
metadata: {custDate: {}},
style: {
top: mystyle.top,
left: mystyle.left,
width: 0,
height: 0
},
shown: true,
sharewith: []
}
I have set the following permissions on the server
userDashboards.allow({
insert: function (userId) {
"use strict";
return userId;
},
update: function (userId, doc) {
"use strict";
return doc.owner === userId;
},
remove: function (userId, doc) {
"use strict";
return doc.owner === userId;
},
fetch: ["owner", "monitors"]
});
I tried this so far on the client:
console.log(userDashboards.findOne({"monitors._id": "5f94f2a15bddd908f2bc9d5d"}));
But I only get the full document, not the embedded document.
So the question is, how can I update innerDoc.style
directly and from the browser?