Reputation: 31
const userExists = await Users.exists({ username: username });
How can I make this userExists boolean case insensitive?
**
It is resulting false if I enter anurag,Anurag,aNurag
**
Upvotes: 1
Views: 2475
Reputation: 1848
You will need to use Regex
const userExists = await Users.exists({ username: { '$regex': username, $options: 'i' } })
i
in options stands for case-insensitive
.
Upvotes: 4