nicolaslopezj / roles

The most advanced roles package for meteor
MIT License
87 stars 13 forks source link

Error: When the modifier option is true, validation object must have at least one operator #18

Closed shingo0620 closed 8 years ago

shingo0620 commented 8 years ago

when calling Roles.addUserToRoles got this error, I think it caused by the schema that I declare with collection2? is it possible to call operation of Roles with out any schema validate?

There are the complete error message with meteor shell

Roles.addUserToRoles('sDpAmDEAPQZQv2T4T', 'admin') Error: When the modifier option is true, validation object must have at least one operator at checkModifier (packages/aldeed_simple-schema/packages/aldeed_simple-schema.js:2293:1) at doValidation1 (packages/aldeed_simple-schema/packages/aldeed_simple-schema.js:2343:1) at doValidation (packages/aldeed_simple-schema/packages/aldeed_simple-schema.js:2758:1) at SimpleSchemaValidationContext.simpleSchemaValidationContextValidate as validate at [object Object].doValidate (packages/aldeed_collection2/packages/aldeed_collection2.js:372:1) at [object Object].Mongo.Collection.(anonymous function) as update at Object.Roles.addUserToRoles (packages/nicolaslopezj:roles/roles_server.js:34:23) at [object Object]:1:-55 at Script.(anonymous function) as runInThisContext at /Users/shingo0620/Documents/Work/project-core/.meteor/local/build/programs/server/shell-server.js:366:27

shingo0620 commented 8 years ago

I fixed it by adding these codes to my user schema roles: { type: [String], optional: true }

nicolaslopezj commented 8 years ago

Great!