LearnBoost/mongoose — Issue #704: Don't allow non-functions to be set as getters or setters
Author: ljharb
Created: 2012-02-01 08:08:07+00:00
State: open

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.