MongoSnapshotQueryBackend

A query backend of one aggregate type on MongoDB: the four primitives over one of the aggregate type's own collections, compiled by the 9.x filter, sort and aggregation compilers (MongoMatchCompiler, MongoAggregationCompiler) on the bindings of MongoQuerySchemaAdapter, its documents read as documents says: its snapshot collection, which MongoSnapshotStore writes, records of the shape of SnapshotRecord.toQueryRecord() (MongoSnapshotDocuments); or its log collection, one record per stream (MongoEventDocuments). Records are projected as MongoProjections says.

Every command carries maxTimeMS of the admitted timeout, and MongoDB cancelling it there is a StorageTimeoutException. A bounded count is countDocuments with limit = n + 1. Lists and offset pages end their sort with the documents' tie-breakers (a snapshot's tenant and aggregate ID), so their order is total; a keyset page orders by the cursor's sort alone, which admission ended with the identity. Driver calls run on dispatcher, virtual threads by default. A collection not created yet holds no documents, so every primitive answers as over an empty collection.

Properties

Link copied to clipboard
open override val aggregateType: AggregateType
Link copied to clipboard

Functions

Link copied to clipboard
open override fun aggregate(query: AdmittedQuery<AggregationQuery>, window: GroupWindow): Flow<ObjectNode>
Link copied to clipboard
open suspend override fun count(query: AdmittedQuery<CountQuery>): Long
Link copied to clipboard
open suspend override fun page(query: AdmittedQuery<Queryable<*>>, window: PageWindow): BackendPage
Link copied to clipboard
open override fun stream(query: AdmittedQuery<ListQuery>): Flow<ObjectNode>