First I've tryed the test of the package, everything is ok.
Here is my code
const admins = Roles.getUsersInRole('admin').fetch();
Meteor.users.find({}).forEach(function (user) {
const group = "G".concat(user._id); // _id can start with a number, prefix with G letter
console.log("process ", user.username, group);
Roles.addUsersToRoles(admins, ['following'], group);
});
If I remove group in last line, it iterates well on each users, when I add group, it stops silently at first iteration -> I've added a console.log(ex) at line 763 of alanning_roles to grab the suspected MongoError exception
{ [MongoError: cannot use the part (roles of roles.GwbBhNhnNv5nAJANZN) to traverse the element ({roles: [ "admin" ]})]
I20171031-15:43:13.690(1)? name: 'MongoError',
I20171031-15:43:13.690(1)? message: 'cannot use the part (roles of roles.GwbBhNhnNv5nAJANZN) to traverse the element ({roles: [ "admin" ]})',
I20171031-15:43:13.691(1)? driver: true,
I20171031-15:43:13.691(1)? index: 0,
I20171031-15:43:13.692(1)? code: 16837,
I20171031-15:43:13.693(1)? errmsg: 'cannot use the part (roles of roles.GwbBhNhnNv5nAJANZN) to traverse the element ({roles: [ "admin" ]})' }
First I've tryed the test of the package, everything is ok. Here is my code
If I remove group in last line, it iterates well on each users, when I add group, it stops silently at first iteration -> I've added a console.log(ex) at line 763 of alanning_roles to grab the suspected MongoError exception
Help would be greatly appreciated ;)
outputs
is this similar to https://github.com/aldeed/node-simple-schema/issues/136 ?