I’ve been trying to solve this problem but to no avail.
Here is my user schema.
Schema.User = new SimpleSchema({
username: {
type: String,
min: 4,
max:20,
label: "Username"
},
createdAt: {
type: Date,
autoValue: function() {
if (this.isInsert) {
return new Date;
} else if (this.isUpsert) {
return {$setOnInsert: new Date};
} else {
this.unset();
}
}
},
profile: {
type: Schema.UserProfile,
optional: true
},
services:{
type: Object,
optional: true,
blackbox: true
},
allowedAccounts:{
type: [String],
optional: true
}
});
Sample data:
allowedAccounts: ["YPLQpjffJ7LS4sgHr", "mwpL9BNukdtfXQNK6"],
profile: {
username: "usernam"
}
Users publication:
Meteor.publish('users', function(){
return Meteor.users.find({}, {fields:{username:1, 'profile.fullname':1, 'profile.gender': 1,createdAt: 1, allowedAccounts: 1}})
});