spring-projects / spring-projects/spring-data-commons

Sorting with ignorecase is rejected despite the documentation

Open
#2,513 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: task
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented sorting table at the linked Spring Data MongoDB reference page and the validation in spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java around line 211. Determine whether MongoDB collation supports the documented ignore-case behavior, then align the documentation or Query behavior and verify the resulting behavior with the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.