I'm trying to have a Role that contains an array of access.
this.caster = new caster(null, castOptions);
TypeError: string is not a function
type: String, is what you want on line 2. Mongoose expects the type to point to a function that can be used to coerce values to the correct type.