sparse index in mongoose code example Example: mongoose sparse index var User = new Schema({ name: { type: String, sparse: true } })