New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding minlength and maxlength to Schema with String as type #1457
Comments
This belongs as a plugin. |
Can you please be more specific? I can't find a plugin regarding this feature. |
You could extend the string schematype similar to how match works. The plugin would just require mongoose and add the function to |
I think, |
Not gonna happen. Mongoose is bloated enough and exposes the apis necessary to extend it. |
Hi, This can be handled using path function like this: var Person = new Schema({ Person.path('title').validate(function (v) { |
looks like it's on its way to the next release: b96d724 |
@sandesh27, thank you for workaround |
Its in 4.0.0-rc2 :) |
Here is the documentation for the new |
Just stumbled upon this. I personally think the ORM/ODM should include as few validations and whatnot built-in, as these are really application concerns, and there are plenty of libraries for this. Keep it lean :) |
how to present date type in schema |
Add a new feature for minimum length and maximum length to Schema with String as type. This will validate minimum and maximum length to corresponding string in schema.
For example,
OR
The text was updated successfully, but these errors were encountered: