How can I retrieve metadata such as the total number of items in a collection to use for pagination? The documentation mentions an meta query parameter, but there’s no example provided. When I try using it, the meta data doesn’t appear.
Metadata is marked as deprecated
Although REST request ?meta=total_count still working on my Directus v11.8.0, i guess you should use aggregate functions to query the total number of items.
REST
?aggregate[count]=*
SDK
import { createDirectus, rest, aggregate } from '@directus/sdk';
const client = createDirectus('https://directus.example.com').with(rest());
const result = await client.request(
aggregate('articles', {
aggregate: { count: '*' },
})
);
