mongoose - SchemeString, precedence of uppercase and match -
i add gender
field accepts [mmff]
, normalizes [mf]
. here's schema:
var userschema = new schema({ name: string, gender : { type: string, upper: true, match: /[mmff]/ } });
i wonder what's sequence of execution of schemestring functions. if uppercase
executed before match
, match
[mf]
.
i have similar question concerning trim
, match
.
thanks.
answered aaron heckmann https://groups.google.com/d/msg/mongoose-orm/l5ztqdfbbwu/gyostzv1ehij
upper , trim setters - when value assigned modified.
match validator - executed later when calling .validate() or .save()
Comments
Post a Comment