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