I'm trying to find out how to enforce unique on a field which isn't an index.
I've seen similar question in here, but the answer of using dropDups: true is mentioned to be depcrated.
what is the correct way of enforcing unique on a field?
const users = new Schema({
email: { type: String, required: true , unique: true},
...});