Collation problem on Serverless instance

Hi, I’m using mongodb with mongoose for a NodeJs api and I have a problem with the missing of collation in Serverless instances.
In the API I give the possibility to sort by any value and paginate the results, here is a snippet of code:

const data = await User.find(paginatedQuery, User.getFields(fieldsToGet[role]), {
			sort: sorter,
			limit: +limit

where paginatedQuery is a query with some optional regex (on the frontend I have a search bar to filter users by name) and some other filters used to get the pagination done.

The problem is that when I sort by a String field because I would use the .collation({ locale: 'en' }) which is not supported on Serverless. Is there another way I can sort the results alphabetically as I need? I can’t do that after I got the result because the pagination is based on the sorted values.

You are right that Serverless instances do not support collations. I am curious, why can’t you use default sorting order - is there a specific collation logic you are using?

MongoDB Atlas Serverless PM team

Seems to be the same issue with Dedicated instance as well?
I am trying to apply regex over compound index using collation of locale en_US.

find({"fname": { "$regex" : "sometext", "$options": "i"}}).collation({locale: "en_US"})

I am getting following error:

Error : {"error":"{\"message\":\"'collation' is not a function\",\"name\":\"TypeError\"}","error_code":"FunctionExecutionError"}

Any advice or suggestion is much appreciated.
Thank you

I have made this working in dedicated instance server-less function query using find options.

db.collection.find(query, projection, {collation: {locale: "en_US", strength: 2}})

Thank you.

There are several reasons why it would be useful to use collation, but the main one is to show to the end user the data in the order he expects (eg. Sorting a table by an alphanumeric field)