I want to make a text search case insensitive with regex query with spring-data mongo .
For example in SQL:
SELECT * FROM Customers
WHERE CustomerName LIKE 'a%';
How can i make this query with spring-data mongo using MongoRepository Query DSL ?
Thanks in advance
2
Answers
you can use query like that hope help you
Here is the raw mongo query for your sql :
db.Customers.find( { CustomerName: /^a/ } )
or
db.Customers.find( { CustomerName: { $regex: /^a/ } } )