I have a MongoDb schema like this
var User = new Schema({ \"UserName\": { type: String, required: true }, \"Email\": { type: String, required: tr
The reason behind this error is that,The index is not present or different in your collection, in which you are trying insert. So Solution is to drop that collection and run your program again.