Skip to content

Add option to perform case-insensitive sort when using "ascending()" or "descending()" on a text field #8119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
CodeWithOz opened this issue Aug 2, 2022 · 5 comments
Labels
type:question Support or code-level question

Comments

@CodeWithOz
Copy link

CodeWithOz commented Aug 2, 2022

New Feature / Enhancement Checklist

Current Limitation

The limitation is that I cannot use ascending() or descending() to order results in a case-insensitive manner. Consider if there are 4 available results:

[
  { name: 'value' },
  { name: 'best' },
  { name: 'Bolt' },
  { name: 'Voltage' },
]

Using ascending('name') will cause them to be ordered as:

[
  { name: 'Bolt' },
  { name: 'Voltage' },
  { name: 'best' },
  { name: 'value' },
]

Feature / Enhancement Description

The idea is to give devs the option to make ascending() and descending() search with or without case sensitivity. It could be implemented by a config option, for instance ascending('name', { ignoreCase: true });

Example Use Case

Please see the example given above.

Alternatives / Workarounds

As far as I'm aware, right now the dev has to perform the case-insensitive sort manually after getting the results, which is redundant.

3rd Party References

Not that I'm aware of. I also haven't used any other tool like parse-server before now, so my experience of such tools is limited.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Aug 2, 2022

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza
Copy link
Member

mtrezza commented Aug 2, 2022

Please do not post your issue in multiple places at once. I removed your posts in other threads.

@mtrezza
Copy link
Member

mtrezza commented Aug 3, 2022

The option already exists. Given the upvotes on #3973 (comment) I would assume that it works.

It's a parameter that you can pass, see

caseInsensitive?: boolean,

I just noticed that there are no simple tests in /spec, only internal tests that deal directly with the DB adapter instance. Would you want to add a test and submit a PR? That could help you to verify that it works and help others who may have the same question as you. I'm also not finding this (and many other options) in the docs, maybe we need to update them?

@mtrezza mtrezza added the type:question Support or code-level question label Aug 3, 2022
@mtrezza
Copy link
Member

mtrezza commented Aug 3, 2022

I'm closing this as it does not seem to be a Parse Server issue.

@mtrezza mtrezza closed this as completed Aug 3, 2022
@CodeWithOz
Copy link
Author

Hey thanks for the feedback! We accepted the case-sensitive search for now so I'll try to look into your suggestions when I have more free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

2 participants