Open jirzi0 opened 4 years ago
@henrikjohansson712 is that not part of the default loopback functionality? If yes, we should add this to the documentation.
The count endpoints have support for the "where" part of the filter, e.g, if you send a request to GET /documents
with the filter:
{
"where": {
"type": "publication"
},
"include": [
{
"relation": "datasets",
"scope": {
"include": [
{
"relation": "techniques",
"scope": {
"where": {
"name": "small-angle neutron scattering"
}
}
}
]
}
}
]
}
then the GET /documents/count
query filter would be:
{
"type":"publication"
}
which would give you all documents of type publication.
So the functionality of the count endpoints is limited, at least when it comes to queries where you filter on related models.
The count endpoints documentation states that they only accept a where query, but maybe it needs some clarification?
Bumping this issue. Thanks for the clarification. Obviously it would be great if the count also took account for the include key query stuff as at is quite a limitation.
Is your feature request related to a problem? Please describe. Implementing pagination using skip & limit, only total resource count is available though (to my knowlage at least). Describe the solution you'd like It would feel more graceful on the frontend side if a total of items returned by specific query was also provided. Describe alternatives you've considered It's all right, I just check for an empty array to come and stop there...