You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
maxlength and minlength validators not in camelCase? #4720
Is there a reason why the minlength and maxlength validators aren't written in camelCase? I lost a few hours trying to figure out why the validation wasn't working. 😭
Maybe this may help prevent others from wasting some time.
As of 5.11 Mongoose allows both minLength and minlength. As well as both maxlength and maxLength. So not a huge deal, but we should likely make sure these are consistent.
Activity
vkarpov15 commentedon Nov 17, 2016
No particular reason other than that's how they've been for many years and it's not worth it to change them :)
shifatul-i commentedon Feb 8, 2018
Please change the documentation here: http://mongoosejs.com/docs/validation.html#update-validators-only-run-on-specified-paths
maxLength -> maxlength
It took me quite some time to figure it out.
dark-cli commentedon Dec 16, 2019
thanks you , you saved me from embarrassing mysel
tonivuc commentedon Jul 7, 2025
They still appear to be uppercase in this doc?
https://mongoosejs.com/docs/schematypes.html#string-validators
vkarpov15 commentedon Jul 8, 2025
As of 5.11 Mongoose allows both
minLengthandminlength. As well as bothmaxlengthandmaxLength. So not a huge deal, but we should likely make sure these are consistent.Merge pull request #15570 from Automattic/vkarpov15/gh-4720
vkarpov15 commentedon Aug 5, 2025
Fixed by #15570