Skip to content

bpmn-server / DocumentPager

Class: DocumentPager#

The data store's paged search (DataStore.find) on any storage adapter: what the MongoDB aggregation (Aggregate.ts) answers, computed from the documents the adapter finds.

  • filter: on the instance (name, data.x) and on its items (items.x); with an item filter, the answer has one entry per matching item, items being that item (MongoDB's $unwind).
  • lastItem / latestItem: instead, one entry per instance, with its last item (by seq) or its latest ended item (by endedAt) matching the condition, under lastItem / latestItem.
  • sort (one field, 1 or -1; default _id descending), limit (10), projection.
  • after: the nextCursor of the page before: <sort value>|<_id> (d:<ms> for a date), or the _id.
  • getTotalCount: how many instances match the filter.

Table of contents#

Constructors#

Methods#

Constructors#

constructor#

• new DocumentPager(): DocumentPager

Returns#

DocumentPager

Methods#

find#

▸ find(store, database, collection, «destructured»): Promise\<FindResult\<any>>

Parameters#

Name Type
store IDocumentStore
database string
collection string
«destructured» FindParams

Returns#

Promise\<FindResult\<any>>

Defined in#

packages/bpmn-server/src/datastore/DocumentPager.ts:19


cursorOf#

▸ cursorOf(row, sortField, value): string

The cursor of a row: its sort value (a date as d:<ms>) and its _id.

Parameters#

Name Type
row any
sortField string
value any

Returns#

string

Defined in#

packages/bpmn-server/src/datastore/DocumentPager.ts:72


cursorRow#

▸ cursorRow(after, sortField): any

A row standing for a cursor, to compare the rows against.

Parameters#

Name Type
after string
sortField string

Returns#

any

Defined in#

packages/bpmn-server/src/datastore/DocumentPager.ts:79

Comments