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

Sort by multiple field keys fail #168

Open
sprzenus opened this issue Oct 17, 2020 · 0 comments
Open

Sort by multiple field keys fail #168

sprzenus opened this issue Oct 17, 2020 · 0 comments

Comments

@sprzenus
Copy link

What I'm trying to do is to get sorted and paginated categories:

Category.query(on: req.db)
            .sort([Category.FieldKeys.nameEN, Category.FieldKeys.namePL])
            .paginate(PageRequest(page: options.page, per: options.itemsPerPage))

The logs I get from my database:

2020-10-17 09:45:49.272 UTC [2275] LOG:  execute <unnamed>: SELECT COUNT("categories"."id") AS "aggregate" FROM "categories"
2020-10-17 09:45:49.278 UTC [2275] ERROR:  operator does not exist: text ->> unknown at character 322
2020-10-17 09:45:49.278 UTC [2275] HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
2020-10-17 09:45:49.278 UTC [2275] STATEMENT:  SELECT "categories"."id" AS "categories_id", "categories"."name" AS "categories_name", "categories"."name_pl" AS "categories_name_pl", "categories"."is_free" AS "categories_is_free", "categories"."updated_at" AS "categories_updated_at", "categories"."created_at" AS "categories_created_at" FROM "categories" ORDER BY name->>'name_pl' ASC LIMIT 30 OFFSET 0
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

No branches or pull requests

1 participant