ladjs/mongoose-unique-validator
Mongoose plugin which adds pre-save validation for unique fields within a Mongoose schema. This makes error handling much easier, since you will get a Mongoose validation error when you attempt to violate a unique constraint, rather than an E11000 error from MongoDB. Fork of the original unmaintained package.
JavaScript