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

Custom order conditions #149

Open
anyinfa opened this issue Sep 6, 2024 · 4 comments
Open

Custom order conditions #149

anyinfa opened this issue Sep 6, 2024 · 4 comments

Comments

@anyinfa
Copy link

anyinfa commented Sep 6, 2024

Currently, sorting is only supported based on the internal field serverCreatedAt. Will custom field sorting be added in the future?

order: {
  // serverCreatedAt: 'desc',
  updatedAt: 'desc'
}

And multi-field sorting?

order: [
  { updatedAt: 'desc' },
  { name: 'asc' }
]
@dwwoelfel
Copy link
Contributor

We will be adding ordering on user-defined fields.

They're not implemented yet because the values are stored in the database as JSON and we wouldn't be able to efficiently order the rows.

The data is stored in the triples table as entity_id, attribute_id, value_json triples. The plan is to add partial indexes to the triples table, one for each type that we support. If you want to order by a custom string attribute, we'll index it in the string partial index and then the order by will be efficient.

@montnyc
Copy link

montnyc commented Oct 31, 2024

Do y'all have a public roadmap for when some of these things will be added? Only ordering by serverCreatedAt is fine for now but not ideal. Would love to be able to filter on other attributes. Also would love to be able to use $lte etc, especially for dates.

@isaachinman
Copy link

Any update on this? This is a complete blocker for our use case, and I imagine many others.

We have collections that contain many thousands of values and cannot reasonably be sorted in memory – let alone handling pagination, etc.

@stopachka
Copy link
Contributor

Hey team! Since we launched strong types yesterday, order is the next big thing!

You can follow along in this PR: #564

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

5 participants