mongoose-unique-validator is a plugin which adds pre-save validation for unique fields within a Mongoose schema.