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
The current version appears to support unique keys however not complex unique keys.
Example
const mongoose = require('mongoose'); const beautifyUnique = require('../scripts/mongoose-beautiful-unique-validation'); const Schema = mongoose.Schema; let modelSchema = new Schema({ name: { type: String, required: true, max: 100 }, serial: { type: String, required: true, max: 100 }, foreignKey: { type: String, required: true, max: 100 }, created: { type: Date, default: () => new Date() } }); modelSchema .index({ foreignKey: 1, serial: 1 }, { unique: true }); modelSchema .plugin(beautifyUnique); module.exports = mongoose.model('model', modelSchema );
Suggested
modelSchema .index({ foreignKey: 1, serial: 1 }, { unique: "'{VALUE}' is already in use" });
The text was updated successfully, but these errors were encountered:
@BusbyActual Any update on this ? Custom message for compound indexes ?
Sorry, something went wrong.
No branches or pull requests
The current version appears to support unique keys however not complex unique keys.
Example
Suggested
The text was updated successfully, but these errors were encountered: