![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
mongoose-types-ext
Advanced tools
A package of mongoose types extensions.
npm install --save mongoose-types-ext
gulp test
Just require the extensions before load your mongoose models:
var mongoose = require('mongoose');
require('mongoose-types-ext')(mongoose);
var YourSchemaDefinition = new mongooseSchema({
someField: {
type: String,
maxLength: 10
},
/* (...) */
});
var YourModel = mongoose.model('YourModel', YourSchemaDefinition);
exactLength
: Sets a exact length string validator.Custom error messages: You can also configure custom error messages and use the special token
{EXACT_LENGTH}
which will be replaced with the invalid value. Ex:
var rule = [4, 'The length of path `{PATH}` ({VALUE}) should be equal {EXACT_LENGTH}.'];
var schema = new Schema({ n: { type: String, exactLength: rule })
var M = mongoose.model('Measurement', schema);
var s= new M({ n: 'teste' });
s.validate(function (err) {
console.log(String(err)); // ValidationError: The length of path `n` (test) should be equal 4.
})
exclusivemin
: Sets a minimum number validator not including the configurated value.Custom error messages: You can also configure custom error messages and use the special token
{EXCLUSIVE_MIN}
which will be replaced with the invalid value. Ex:
var rule = [10, 'The value of path `{PATH}` ({VALUE}) should be greater than ({EXCLUSIVE_MIN}).'];
var schema = new Schema({ n: { type: Number, exclusivemin: rule })
var M = mongoose.model('Measurement', schema);
var s= new M({ n: 10 });
s.validate(function (err) {
console.log(String(err)); // ValidationError: The value of path `n` (10) should be greater than 10.
});
I am very glad to see this project living with pull requests.
Copyright (c) 2015 Daniel Campos
Licensed under the MIT license.
0.2.0 (2015-05-20)
<a name"0.1.0"></a>
FAQs
A package of mongoose types extensions
The npm package mongoose-types-ext receives a total of 4 weekly downloads. As such, mongoose-types-ext popularity was classified as not popular.
We found that mongoose-types-ext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.