You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing an app in Ukrainian language and the sorting for some characters doesn't work as expected.
Having a posts collection with a single text field title, I'm trying to fetch them using local api:
I've seen a similar issue #6719 where it is suggested to change the mongo collation strength, but this doesn't resolve the issue, because the locale is just wrong.
I can get the documents with correct sorting using mongoose directly:
but the results are untyped and it feels like a hack using low level api for something that should work on high level.
I can see that payload.find accepts a locale param, but it doesn't change anything, and seems like it's used for i18n.
There's also a collation argument for mongooseAdapter but it does not accept locale.
Hey, we have a PR in review for this but just note that you will need to apply collation config in your mongodb adapter for locale to be applied from locale: 'uk' within your queries.
At a minimum you will need this once the fix has gone out. We thread the locale from your request into the underlying queries
Describe the Bug
I'm developing an app in Ukrainian language and the sorting for some characters doesn't work as expected.
Having a
posts
collection with a single text fieldtitle
, I'm trying to fetch them using local api:The resulting documents are not sorted correctly.
I've seen a similar issue #6719 where it is suggested to change the mongo collation strength, but this doesn't resolve the issue, because the locale is just wrong.
I can get the documents with correct sorting using mongoose directly:
but the results are untyped and it feels like a hack using low level api for something that should work on high level.
I can see that
payload.find
accepts alocale
param, but it doesn't change anything, and seems like it's used for i18n.There's also a
collation
argument formongooseAdapter
but it does not accept locale.Link to the code that reproduces this issue
https://github.com/payloadcms/payload
Reproduction Steps
pnpm dev _community
Роман
,Віктор
,Євген
Expected result:
["Віктор", "Євген", "Роман"]
Actual result:
["Євген", "Віктор", "Роман"]
Which area(s) are affected? (Select all that apply)
db-mongodb
Environment Info
The text was updated successfully, but these errors were encountered: