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

No Update hook? #32

Closed Bosek closed 7 years ago

Bosek commented 8 years ago

There is missing update hook on last version. Intended? When I try findOneAndUpdate, it works.

"mongoose": "^4.6.5",
"mongoose-beautiful-unique-validation": "^5.1.1",
rodrigogs commented 7 years ago

Use save function to update your model. Update function doesn't provide enough information to build a ValidationError.

rodrigogs commented 7 years ago

Just found it:

https://github.com/blakehaswell/mongoose-unique-validator#find--updates

matteodelabre commented 7 years ago

Hi folks! Sorry for the delay in answering your questions. Model.update() should indeed be supported but wasn’t correctly tested so I didn’t notice that it wasn’t working correctly. I’m working on it in #37.

matteodelabre commented 7 years ago

This will be fixed in the next major version. Thanks again for the report!