Using regex = { name : { $regex : inputName, $options: 'i' } }
even when input name is blank, the query returns the first document.
Even when input is a
, query returns the first document which have a
anywhere in the name.
I want if then input name is "jo", then it should only return the first document either with name "Jo", "JO", "jO", "jo".
Please remember i recieve inputName as variable