Atlas Search sort with collation locale

Hi @Aasawari

Thank you for the suggestion to use collation with the $search aggregation stage. I tried it on my sample data but still seeing some issues.

My data contains two Chinese words: “世紀” and “中國”. When sorting these in ascending order without $search, specifying the zh_Hant collation works as expected and returns the order as “中國” then “世紀”.

However, when using $search with the sort field inside, like in the example you provided, the zh_Hant collation is not applied and it returns the words in lexical instead of character order - “世紀” then “中國”.

I’m wondering if there is any limitation around collation not being fully supported inside the $search stage sort field? I’m using MongoDB Atlas v5.0.25

Regards,
Alan

1 Like