繁体   English   中英

meteorjs中collection2中的用户数组

[英]User array in collection2 in meteorjs

我如何在collection2数组中存储流星帐户用户的用户ID。 我对架构的定义如下所示。 这样行吗?

我想要一种将关联用户添加到集合中的方法。 因此,我想控制允许哪些人查看此收藏集中的特定文档。 有没有比我建模更好的方法了。

 name: { type: String, max: 100, optional: false }, billingAddress: { type: AddressSchema }, shippingAddress: { type: [AddressSchema] }, type: { type: String, max: 20, allowedValues: ['Vendor', 'Customer', 'Self', 'Employee'], optional: false }, phones: { type: [String] }, emails: { type: [String], regEx: SimpleSchema.RegEx.Email }, website: { type: String, regEx: SimpleSchema.RegEx.url }, isCustomer: { type: Boolean, optional: false }, isVendor: { type: Boolean, optional: false }, isSearchable: { type: Boolean, optional: false }, associatedUsers: { type: [Meteor.users] } 

每个文档都会自动收到一个_id 不建议将_id放在模式中。 不确定它是否还能为您工作。

如果您想知道它是否可以工作,建议您自己尝试! 您已经有了模式。

对于用户权限,我建议使用alanning:roles包。 那应该解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM