我有一个包含这样文件的集合:
{
_id: af3F3afafaa,
firstName: "John",
family: [{name: "David", relation: "brother", alive: true},
{name: "Susan", relation: "mother", alive: false}]
}
有没有办法编写隐藏字段数组中字段的出版物?所以,如果我订阅了该出版物,我会得到:
{
_id: af3F3afafaa,
firstName: "John",
family: [{name: "David", alive: true},
{name: "Susan", alive: false"}]
}
答案 0 :(得分:0)
根据Meteor docs,这样的事情可以起作用:
Meteor.publish('family', function(famId) {
return Families.find(famId, {
fields : {
"family.relation" : 0 //Exclude family.relation from the sent data
}
});
});