如何将meteor配置文件的值分配给collection2架构?我需要分配电子邮件地址和姓名。
我认为它可能是这样的但不是:
email: {
type: String,
regEx: SimpleSchema.RegEx.Email,
defaultValue: function() { return this.user().emails[0].address }
},
有什么想法吗?
答案 0 :(得分:0)
将其按电子邮件地址排序:
email: {
type: String,
regEx: SimpleSchema.RegEx.Email,
defaultValue: function(){ return Meteor.user().emails[0].address }
},
对于个人资料名称:
firstName: {
type: String,
regEx: /^[a-zA-Z]{2,25}$/,
defaultValue: function(){ return Meteor.user().profile.name }
},