0
votes

I'm using spring-data-mongodb:2.2.2.RELEASE, spring-boot-starter-webflux:2.2.2.RELEASE and a Mongodb v4.2.x. I need change the database collation in order to set it for being case insensitive for all queries.

I check the doc:

but I don't figure out how use it with reactive templates.

@Configuration
@EnableReactiveMongoRepositories
class MongoConfig {

// How should I use it?

}
1

1 Answers

0
votes

Since version 3.4, MongoDB supports collations for collection and index creation and various query operations.

Any of this solution:

  • Modify your @Document entity to specify collation
  • Modify your @Repositories with @Query (Example 82. Collation support for Repositories)
  • Find, Aggregation, etc...

https://docs.spring.io/spring-data/mongodb/docs/2.2.5.RELEASE/reference/html/#mongo.collation