We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have the following schema
const mongoose = require('mongoose'), uniqueValidator = require('mongoose-beautiful-unique-validation'), Schema = mongoose.Schema; const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; const ClientSchema = new Schema({ name: { type: String, required: [true, 'Campo nombre es requerido'], }, email: { type: String, unique: 'Ya existe un cliente registrado con el correo: \'{VALUE}\'', required: [true, 'Campo email es requerido'], validate: { validator: v => re.test(v), message: props => `Ingrese un correo valido` } }, address: { type: String, required: [true, 'Campo dirección es requerido'], validate: { validator: v => v.length >= 5, message: props => `Ingrese una dirección valida` } }, phone : { type: String, unique: 'Ya existe un cliente registrado con el telefono: \'{VALUE}\'', required: [true, 'Campo telefono es requerido'], validate: { validator: v => !isNaN(v) && v.length >= 7, message: props => `'${props.value}' no es un número telefónico válido` } } }); ClientSchema.plugin(uniqueValidator);
The problem is, that mongoose-beautiful-unique-validation is validating address as an unique field when I never set the unique property on that field.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have the following schema
The problem is, that mongoose-beautiful-unique-validation is validating address as an unique field when I never set the unique property on that field.
The text was updated successfully, but these errors were encountered: