发布有关Meteor.users的某些信息,以及有关Meteor.user的更多信息 [英] Publish certain information for Meteor.users and more information for Meteor.user
本文介绍了发布有关Meteor.users的某些信息,以及有关Meteor.user的更多信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为所有用户提供对一组特定字段的客户端访问权限,而我想仅对当前用户具有更多访问权限.我该如何编写发布代码来完成此任务?
I want to have client-side access for a certain set of fields for ALL users while I would like to have access to even more fields for the current user only. How do I go about writing publish code to accomplish this?
推荐答案
流星文档:
Meteor.publish("userData", function () {
return Meteor.users.find({_id: this.userId},
{fields: {'other': 1, 'things': 1}});
});
还有:
Meteor.publish("allUserData", function () {
return Meteor.users.find({}, {fields: {'nested.things': 1}});
});
希望这会有所帮助.
这篇关于发布有关Meteor.users的某些信息,以及有关Meteor.user的更多信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文