Schema (../models/add.js)
var addSchema = new Schema({ name: {type: String, unique: true, sparse: true}, phone: Number, email: String, countr
You need to drop the old, non-sparse index in the shell so that Mongoose can recreate it with sparse: true the next time your app runs.
sparse: true
> db.contacts.dropIndex('name_1')