Reputation: 271
I have in my database the field "City". The field is entered by the user. How can I search with collection.find for upper and lower case independently?
So that Business.find({ city : city }
displays "Berlin" and "berlin" as result?
Or I need to create two request to the database, with search for upper and anotherone for lower case?
I have the latest Mongoose and NodeJS Version.
Solved found in mongoDB docs the following code which works for me
Business.find({ city : { $regex: city, $options: 'i' } }
Upvotes: 0
Views: 1879
Reputation: 271
Solved
Found in MongoDB docs the following which works for me
Business.find({ city : { $regex: city, $options: 'i' } }
Upvotes: 1