if(Meteor.users.find().count() == 0){
var users=[
{email: "admin@home.com", username: “admin”, name: “admin”, roles:[‘admin’]},
{email: "user@home.com", username: “user”, name: “user”, roles:[‘user’]}
];
_.each(users, function(userData){
var userid = Accounts.createUser({
email: userData.email,
password: “test1”,
profile: {username: userData.username},
profile: {name: userData.name},
roles: userData.roles
});
Roles.addUsersToRoles(userid, userData.roles);
});
}
JSON From MongoDb- users:
{
"_id" : “FkTHSdp6GJBRxwqH9”,
“createdAt” : ISODate(“2015-07-05T17:20:15.624Z”),
“services” : {
“password” : {
“bcrypt” : “$2a$10$/G8L1txawsJcN1R5nMnIl.m9ksfHAfWRHBnvHeAXO2ODa4vFkBTES”
}
},
“emails” : [
{
“address” : "admin@home.com",
“verified” : false
}
],
“profile” : {
“name” : “admin”
}
}
I checked the users document, theres is no roles column and also i checked the Roles collection, no rows has been inserted.