Skip to content
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

How to sort alphabetically? #30

Closed
HarleyDavidson86 opened this issue Nov 2, 2021 · 0 comments · Fixed by #33
Closed

How to sort alphabetically? #30

HarleyDavidson86 opened this issue Nov 2, 2021 · 0 comments · Fixed by #33

Comments

@HarleyDavidson86
Copy link

I have a collection like this one:

[
   { address: "a" },
   { address: "b" },
   { address: "A" },
   { address: "B" },
   { address: "c" },
   { address: "D" },
]

My query looks like this:

paginatedData, err := mongopagination.New(collection).Context(ctx).
   Limit(limit).
   Page(page).
   Filter(paginationFilter).
   Decode(&addresses).
   Sort("address", 1).
   Find()

I'd expect the following order in the response: a, A, b, B, c, D
but in fact it is: A, B, D, a, b, c

How can I sort the elements in alphabetically order? Is there a way to set a "collation" or something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant