Well I have already done in mongoose schema by setting my property with unique:true like below
mongoose.Schema({ userName: { type: String, unique: true }})
this time i want to do it through my router api's
User.findOne({userName: req.body.userName})
it only works when i enter same string as save already in database.like
userName: ranatouseef
but if i enter userName: ranaTouseef it fails,
well regix don't work here like regix also have issue like that well if i search for userName: rana regix find it ranatouseef. well same goes for touseef to well my issu is find same string but without casesensitive,
how can i do that.