Say we want the email
field on our User
model to be unique, so we set the Schema to be:
const UserSchema = new Schema({
email: {type: String, required: true, unique: true}
});
Somehow, it just doesn’t work. As it turns out, there are plenty of reasons why this wouldn’t work. Let’s see which one got you.
Continue reading