user10433098
user10433098

Reputation: 1

Find Data in MongoRepository in case insensitive type

I have a collection in mongodb in which the _id is of type string. I am trying to fetch a data from Mongodb in springboot using findById(String id) method which is provided by MongoRepository. But the findById(String id) method seems to be case sensitive , how can i look for data in mongodb with matching id with case insensitive type.

How can same be done for MySQL using JpaRepository ?

I have tried this query @Query("{ '_id' : { $regex: ?0, $options: 'i' } }")
UniqueCam findByUniqueCamCodeIgnoreCase(String id);

But it is not working .

Please help me solve this issue .

Upvotes: 0

Views: 24

Answers (0)

Related Questions