Select to view content in your preferred language

Unexpected behavior when paginating through CDF based service.

394
1
09-19-2025 07:03 AM
Francisco_R
Esri Contributor

Hi, I think I might have came across a problem:

When requesting data using Partial Fetch pattern, it looks like ArcGIS Server transforms the data instead of just forwarding the response prepared by the provider.

 

Context:

I am struggling with the pagination requests. I don't manage to make sense of the Provider Response.
The data  is a Mongo collection with 300k+ records, and I query the REST endpoint directly with these parameters:
resultRecordCount=3&resultOffset=2


I have confirmed (using breakpoints and logging) that the getData function returns a proper GeoJSON with 3 records with IDs 3,4,5. However the JSON Response from AGS 11.5 (and also the localhost Node App when debugging) returns a single feature with OID = 5. See image below

Francisco_R_0-1758289585557.png

I am trying to implement a read-only Feature Service with partial fetch pattern. But this makes things not work in Map Viewer or Pro, as the only proper response is the very first page (resultOffset=0), the rest of them seem to be just misinterpreted by ArcGIS Server. Because the resultOffset=n value will "drop" n-records from the following queries.

The clients manage to compute how many requests are needed and build the paginating requests properly, but the service returns wrong answers.

May I ask for some suggestions, ways around (or an explanation)?


My interpretation of the Query API docs is that I am returning a correct answer, but that is not "forwarded" to the client by the framework.

 

0 Kudos
1 Reply
Francisco_R
Esri Contributor

In case others are interested in this:

This behavior was actually expected, because in the code I did not "inform" the framework that I have already processed the request at my provider code. So it filtered it again, producing wrong results.

The returned object should contain metadata about the filters handled by the provider, so the other filters are handled by the framework. This is done by appending the filtersApplied object to the response object and setting proper booleans accordingly:

  const filtersApplied = {
   where: true,
   objectIds: true,
   geometry: true,
   resultRecordCount: true,
   resultOffset: true,
  };

// And return it:
  return {
   ...responseObject,
   filtersApplied,
   metadata
}