It’ll depend on the technology that you’re working on.
If I understand correctly, you want to retrieve all categories with the total count of documents linked to them. Is that right?
e.g Let’s say x,y, and z are documents of the type ‘Article’. If you run a predicate like this it will give you all articles of a related to a given category
If you’re working with GraphQL, you could do a query that does something similar. You’d call allArticles and then filter them by the category field that matches the given ID:
Thanks for the reply.
I am using JavaScript (NodeJS env) to query Prismic.
I think you didn’t get my question Correctly,
Suppose I have a Document Type called blog-type and it is having a custom filed called Category in it. (Assigning A or B or C Values to this category field)
I have 100 articles of blog-type Doctype. Out of which 40 are of A category, 30 are of B Category, and rest 20 are of C category articles.
Requirement:
I need a single query to retrieve 5 A Category, 7 B Category, and 9 C Category blog-type Category type Articles.
or
I need a query to retrieve 5 number of articles each A, B and C Categories of blog-type Category type Articles.
Hey, returning to our old convo. Queries like this aren't possible just yet in Prismic. You can instead query by the given field that you are using to assign 'categories' to your documents and then filtering out the number of documents that you need to display
Pau
closed , flag & select 'Something Else' to reopen.
8