spring-projects / spring-data-commons

Spring Data Commons. Interfaces and code shared between the various datastore specific implementations.
https://spring.io/projects/spring-data
Apache License 2.0
773 stars 672 forks source link

Sorting with ignorecase is rejected despite the documentation #2513

Open vgarmash opened 3 years ago

vgarmash commented 3 years ago

In current documentation https://docs.spring.io/spring-data/data-mongodb/docs/current/reference/html/#core.web.basic I see the following table: image

It states that it is possible to change case sensitivity for sorting.

Although when trying to use "ignorecase" keyword I am getting the following error:

{
    "message": "Given sort contained an Order for patient.lastName with ignore case! MongoDB does not support sorting ignoring case currently!"
}

The message comes form the Query class: https://github.com/spring-projects/spring-data-mongodb/blob/73a0f0493358dae7040ff3613524ca1450e2a585/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java#L211

Either things got changed and there is a way to sort with ignorecase (I guess the collation with strength 1 or 2 can help) or the documentation was copied from somewhere else without considerations of Mongodb specifics.

Please fix the documentation or fix the Query class.

christophstrobl commented 2 years ago

Thanks for reporting - we'll highlight store specific deviation of functionality provided via the commons module.