I misread the documentation and passed "true" for "get" when creating a schema. This led to an error in the save callback: [TypeError: Object true has no method 'call']
Obviously I'm the one who messed up, but it would be nice if it failed much faster. Attempting to create a schema with a getter or setter that's not a function should either cause an error, be ignored, and/or console.log a warning - it would have saved me hours of troubleshooting.
I'd do the pull request myself but I'm not sure where that check should be added. If somebody can point me to the file/function/line, I'll be happy to make the change.
The relevant lines are in the SchemaType prototype, https://github.com/LearnBoost/mongoose/blob/master/lib/schematype.js#L111-133
Something along the lines of typeof(fn) === 'function' would probably suffice, however, not sure if this appropriate, and what the thoughts of the principle maintainers on this kind of defensive argument/type checking. Comments?
typeof(fn) === 'function'
Since "required" forces any !== false value to be true, I'm going to go with "force a sensible value". Pull request in #706
Fixing typos and throwing an Error instead in #707
Pull request's merged, thanks!
ocd + test