Skip to content

maxlength and minlength validators not in camelCase? #4720

Closed

Description

@gsccheng

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.

http://mongoosejs.com/docs/validation.html

Activity

  1. vkarpov15 commented on Nov 17, 2016

    @vkarpov15
    Collaborator

    No particular reason other than that's how they've been for many years and it's not worth it to change them :)

  2. shifatul-i commented on Feb 8, 2018

    @shifatul-i

    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.

  3. added this to the 5.0.5 milestone on Feb 12, 2018
  4. added
    docs
    on Feb 12, 2018
  5. dark-cli commented on Dec 16, 2019

    @dark-cli

    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.

    thanks you , you saved me from embarrassing mysel

  6. tonivuc commented on Jul 7, 2025

    @tonivuc

    They still appear to be uppercase in this doc?
    https://mongoosejs.com/docs/schematypes.html#string-validators

  7. vkarpov15 commented on Jul 8, 2025

    @vkarpov15
    Collaborator

    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.

  8. modified the milestones: 5.0.5, 8.16.3, 8.16.4, 8.16.5 on Jul 8, 2025
  9. modified the milestones: 8.16.5, 8.17.1 on Jul 25, 2025
  10. added a commit that references this issue on Aug 5, 2025
  11. vkarpov15 commented on Aug 5, 2025

    @vkarpov15
    Collaborator

    Fixed by #15570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docs

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions