I have Cosmos db as our database and my java application runs on Spring Boot. I'm using Spring Data's MongoRepository to query the database.
I have a requirement where I need to find results based on a field and it needs to be case insensitive.
What I tried ...
- appending mongorepository method with "IgnoreCase"
- adding regex in query ... @Query("{fieldName: {$regex: '^?0$', $options: 'i'}}")
The above solutions work with my mongodb(on my local) but doesn't work on cosmosdb .
I thought that the issue might be because of version of the software I'm using or some driver I'm using so I ran the same query on mongocompass (connecting to mongodb) and robo3t (connecting to cosmosdb), but the query doesn't with cosmos.
So my assumption is cosmos doesn't support the above queries
Now i'm not going to switch to mongodb since i'm not the one making the decision, i'm stuck with cosmos and I have to provide solution to the latter.
I've searched about collation, but haven't found any results or documentation on how to do it with cosmosdb and most likely this is not an option for me.
So is there any other way to query the database with no case sensitivity or is there anything wrong which I'm doing here?