Solved

Pagination and returning records at a specific page

  • 27 July 2023
  • 2 replies
  • 70 views

Hello data modeling team, I tried the "first" and "after" filter on Query Explorer which enables us to retrieve the query result page by page, it works well.

while we have an existing API which enables the consumer to specify an "offset" and a "limit" parameter. by the offset, the consumer could retrieve records at any specific page without the need to always go though from the beginning and then retrieve page by page, it's like the skip and limit syntax in mongodb, for example, db.myCollection.find().skip(200000).limit(50).

we want to keep the API behavior so no modification needed for existing consumer, while we do not want to simulate the offset behavior by retrieving page by page within our own API since it will be very low efficient when there is a big dataset, so is it possible to provide the offset supporting in Cognite ? or any suggestions/methods we could try to implement this ? Thanks!

 

icon

Best answer by Jason Dressel 27 July 2023, 18:46

View original

2 replies

add a image for the question

 

Userlevel 4
Badge

@Lihui Meng,
Today, getting a list of pages or navigating by offset is not supported.  This was a conscious decision.  In short, records may change (added or deleted) by other users or processes while any given user is navigating the records.  Navigating to a particular offset may return different records each time the request is made.
 

A similar request was asked: 

-Jason

Reply