matteodelabre / mongoose-beautiful-unique-validation

Plugin for Mongoose that turns duplicate errors into regular Mongoose validation errors
MIT License
117 stars 38 forks source link

Doesn't work with mongoose 5.12.5 and nestjs #67

Open fdorantesm opened 3 years ago

fdorantesm commented 3 years ago

I tried using globally and sat directly in a schema:

@Prop({
    raw: {
      index: true,
      required: true,
      unique: 'Email ({VALUE}) is already registered',
      type: String,
    },
  })
  public email: string;
@Prop({
      index: true,
      required: true,
      unique: 'Email ({VALUE}) is already registered',
      type: String
  } as PropOptions<any>)
  public email: string;
[Nest] 23477   - 04/22/2021, 1:22:02 AM   [ExceptionsHandler] Validation failed +1471ms
ValidationError: Validation failed
    at /Volumes/dev/organic/dist/main.js:1975:31
    at processTicksAndRejections (internal/process/task_queues.js:97:5)