MongoDB server side pagination

Is server-side pagination supported for MongoDB source? If so, are there any resources explaining how to configure it?

I worked it out. The quickest way to implement pagination with MongoDB is to use the limit offset based.

Assuming your table is called "dataTable" and query is "mongoQuery" you will want to do the following:

  1. In the table enable server side pagination.
  2. Table's data should be set to{{ }}
  3. In query config set limit value to {{ dataTable.pageSize }}
  4. In query config set skip value to {{ dataTable.paginationOffset }}
  5. If your query is configured to be run manually, add {{ dataTable.paginationOffset }} to the query's watched inputs to force it to refresh when the table page is changed.

Note: this method of pagination is not performant. It requires scanning all the previous docs before reaching the desired one, so it becomes slower as the offset increases . Also since there is no "snapshotting", the data will be inconsistent and shift around. This might be noticeable in busy collections.

However, for basic pagination in case that the most relevant info appears on the first pages (use sort), this is good enough.