question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing through collation options for case insensitive sorting

See original GitHub issue

Steps to reproduce

Create a service, then attempt to sort case insensitively on one of the document fields

Expected behavior

Should be able to pass through collation options to be able to set the strength of the sort.

Actual behavior

No mechanism for passing through collation options

Suggested Fix

Addition of $collation or $options query param to allow passing through of collation options, similar to how $sort is passed through

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that’s not working): 5.1.0

NodeJS version: 8.4.0

Operating System: Ubuntu 16.04

Browser Version: Chrome 60

React Native Version: N/A

Module Loader: N/A

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
chloeharpercommented, Aug 18, 2017

There’s two options to provide collation:

const collation = { locale: 'en', strength: 2 }
MyModel.find({}, null, { collation: collation });

or

const collation = { locale: 'en', strength: 2 }
const query = MyModel.find({})
query.collation(collation)
0reactions
superbarnecommented, Oct 4, 2018

@daffl this can be closed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sorting and case sensitive collations - Simple Talk
When it comes to case insensitive collations, it is pretty clear, data is sorted as if 'A' and 'a', are the same character....
Read more >
Case Insensitive ORDER BY clause using COLLATE
the ORDER BY "string" COLLATE "POSIX" query returns rows in closer to ... Is there a COLLATE clause value that would sort Case...
Read more >
Case insensitive sorting in MongoDB
This means the only way to sort case insensitive currently is to actually create a specific "lower cased" field, copying the value (lower...
Read more >
SQL Server Collation (ASCII Table sort and Case ...
1) Use a SQL Server case-sensitive Collation. These sort upper-case before lower-case, per each letter (not all upper-case before all lower-case) ...
Read more >
Linguistic Sorting and Matching
Oracle Database compares character strings in two steps for monolingual collation. The first step compares the major value of the entire string from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found