LearnBoost/mongoose — pull request #2247 by nelisbijl (2014-08-13 09:21:55+00:00)
Title: Conditionalrequired

Per request moved from 3.8.x to master (see #2220)
(Git is great but extremely difficult when you lack the experience; hope I didn't cause any trouble)

Conditional required: allows the value for required to be a callback:
name : { type: String, required: function () { /* this is doc */ return true/false; } }