如何使用 Collection.find() 只返回字段中的嵌套属性



有一种方法可以使用collection.find()只返回字段的嵌套属性? 我在集合中存储了一些信息users特别是在我添加属性profile字段中:imagepath

所以我想发布用户集合,显示username,只有属性imagepath profile(配置文件有额外的信息,不敏感但体积庞大)。

Meteor.publish('UsersInfo', function () {
    return Meteor.users.find({},{fields:{username:1, profile.imagepath:1}});
});

问题:查询中的字段未将profile.image识别为字段。

引号括起来profile.imagepath。即:"profile.imagepath"

最新更新