Skip to content

[oData Handler] Count Not Behaving as Expected #944

Open
@cpoliver

Description

@cpoliver

Following #864 I've got the latest version of the oData handler and GraphQL Mesh running and can confirm that both count and inlineCount are now valid QueryOptions.

However, using the count query option doesn't seem to do anything, and running the separate generated query with the same filter does not apply the filter. In fact, the filter appears to be ignored completely in the count query (TenanciesCount), because you can pass an invalid oData filter string and nothing happens, whereas you get an error if you pass it to the main (Tenancies) query.

Here is an example of my query:

query Demo {
	Tenancies(queryOptions:{
	  filter: "startswith(friendlyname, 'IAM')"
	  top: 3
	  count: true # the option is here but it does't seem to affect the returned object graph
	}) {
	  id
	  friendlyName
	  status
	}
	
    TenanciesCount(queryOptions:{
	  filter: "startswith(friendlyname, 'IAM')"
	})
}

Which returns:

{
  "data": {
    "Tenancies": [
      {
        "id": "3225f4b0-1fa0-ea11-9cd8-84fdd17eeb35",
        "friendlyName": "IAMCloud",
        "status": 1
      }
    ],

    "TenanciesCount": 4
  }
}

I'm not sure how I can get the count of the total number of filtered results, so I can handle pagination on the client side.

In the example above I'd TenanciesCount to be 1 in the example above, as there is 1 result for that given filter, and 4 results when the filter is not applied. Also, as an example, if there were 200 results when applying the filter, and I also requestion the top: 10 in the queryOptions, I'd still expect a count of 200 as this is the total amount of results, which is required to calculate the pagination.

I hope that contains enough information. Pinging @ardatan who was discussing this with me and asked me to raise an issue.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions