directus / directus/docs

Add sorting + aggregations docs

Open
#178 2 comments 3 reactions 0 assignees View on GitHub
Docs
Dominant language
TypeScript
Stars
22
Forks
82
Avg merge
18h 49m
Merged PRs (30d)
4

Description

### Describe the Request

Currently in the directus documentation, there is nothing (or I have not found it) regarding how to order the results through aggregated fields. After looking at the code and finding this PR: https://github.com/directus/directus/pull/19568, I realized that you could sort by, for example, a "count" result in descending order.

Example with SDK:
```js
{
aggregate: {
count: 'id',
},
groupBy: ['company'],
query: {
sort: ['count.id']
}
}
```
This would sort the result of count.id in descending order.

It would be great if this was added to the documentation in some way, since, currently from my point of view, there is a lot of information missing regarding how to take advantage of aggregation and grouping.

### Maintainence Strategy

Every time the sorting strategy is changed in the aggregation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.