Closed jrouleau closed 9 years ago
Allows users to access the mongoose validate scope from within a custom validator function.
Example:
var mongoose = require("mongoose"); var validate = require("mongoose-validator"); var MySchema = new mongoose.Schema({ path: { type: String, validate: [ validate({ validator: function (val) { if (!this.isModified("path")) { return true; } // ... }, message: "Invalid ..." }) ] } });
Thanks for this. Would you mind adding a test or two and I'll get this merged in.
This has been merged in with the latest patch update
Allows users to access the mongoose validate scope from within a custom validator function.
Example: