Ir al contenido
Español

MongoSnapshotStore

Esta página aún no está disponible en tu idioma.

Defined in: src/persistence/snapshot-stores/MongoSnapshotStore.ts:39

SnapshotStore backed by MongoDB.

One document per (persistenceId, sequenceNr) behind a unique index, so save at an existing sequence number overwrites in place and loadLatest is an indexed descending read. Payloads are JSON text for the same reason as in MongoJournal — exact round-trip fidelity over queryability the framework does not use.

PersistenceOptions (compression, encryption) are ignored, matching the SQL and Cassandra stores; the object-storage store is the one that honours them.

new MongoSnapshotStore(options?): MongoSnapshotStore

Defined in: src/persistence/snapshot-stores/MongoSnapshotStore.ts:45

MongoSnapshotStoreOptions = {}

MongoSnapshotStore

MongoStore.constructor

close(): Promise<void>

Defined in: src/persistence/LazyStore.ts:66

Best-effort teardown.

Promise<void>

SnapshotStore.close

MongoStore.close


delete(persistenceId, toSeq): Promise<void>

Defined in: src/persistence/snapshot-stores/MongoSnapshotStore.ts:99

Delete snapshots up to and including toSeq. Useful for pruning.

string

number

Promise<void>

SnapshotStore.delete


loadBefore<S>(persistenceId, seq, _options?): Promise<Option<Snapshot<S>>>

Defined in: src/persistence/snapshot-stores/MongoSnapshotStore.ts:89

Load the newest snapshot with sequenceNr < seq, or None.

S

string

number

PersistenceOptions

Promise<Option<Snapshot<S>>>

SnapshotStore.loadBefore


loadLatest<S>(persistenceId, _options?): Promise<Option<Snapshot<S>>>

Defined in: src/persistence/snapshot-stores/MongoSnapshotStore.ts:79

Load the newest snapshot for persistenceId, or None if none exist. options.encryption is required when client-side encryption was used at write time — the store has no other way to obtain the master key. Stores that don’t encrypt ignore the field.

S

string

PersistenceOptions

Promise<Option<Snapshot<S>>>

SnapshotStore.loadLatest


save<S>(persistenceId, seq, state, _options?): Promise<Snapshot<S>>

Defined in: src/persistence/snapshot-stores/MongoSnapshotStore.ts:63

Persist a snapshot at seq — typically the seq of the latest event applied. Optional options carry per-call preferences from the caller (e.g. compression/encryption set on the actor). Stores that cannot honour them silently ignore the field.

S

string

number

S

PersistenceOptions

Promise<Snapshot<S>>

SnapshotStore.save