Enonic version: 7.9.2
I need to know how many objects there are of a certain content type. Is there a way to use guillotine to return counts for specific queries?
I need to know how many objects there are of a certain content type. Is there a way to use guillotine to return counts for specific queries?
Hi @donfelice,
You can use the queryConnection
field with count
aggregation. Then you will be able to get count from aggregationsAsJson
field in the response , for example:
Query:
query {
guillotine {
queryConnection(query: "type='com.enonic.app.hmdb:article'", aggregations: [{
name: "countArticleTypes",
count: {
field: "type"
}
}]) {
aggregationsAsJson
}
}
}
Response:
Best regards,
Anatol