prorm API Reference
    Preparing search index...

    Class RavenDbStore

    Base interface for NoSQL stores.

    NoSQL engines (document stores, key-value caches, partition-key stores) do not share the SQL-shaped Dialect interface (no query(sql), no identifier escaping, no DDL). NoSqlStore is intentionally minimal: connection lifecycle plus a raw escape hatch. Each store's real API surface (find/insert/update for Mongo, hash/list/set ops for Redis, item CRUD for DynamoDB) lives on its own class, not on this interface, because forcing them into one shared query shape would misrepresent what each engine can actually do.

    Implements

    Index
    name: "ravendb" = 'ravendb'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "ravendb" = 'ravendb'

    The client library being used

    • Store a document in collection; returns the id used.

      Parameters

      • collection: string
      • doc: Record<string, unknown>

      Returns Promise<unknown>

    • Load a document by id.

      Parameters

      • _collection: string
      • id: string

      Returns Promise<unknown>

    • Load, merge patch, and save; returns the updated entity.

      Parameters

      • _collection: string
      • id: string
      • patch: Record<string, unknown>

      Returns Promise<unknown>

    • Delete a document by id.

      Parameters

      • _collection: string
      • id: string

      Returns Promise<unknown>

    • Query collection with an ORM where clause. The where object accepts the full ORM operator surface (Op.gt, Op.in, Op.between, Op.like, Op.and/Op.or, ...), translated to native RavenDB session-query conditions - so a plain { field: value } still behaves as equality, but richer queries no longer require hand-written RQL. Bare-field values are ANDed together (Op.* comparisons expand per field).

      Parameters

      • collection: string
      • where: Record<string | symbol, unknown> = {}

      Returns Promise<unknown[]>

    • Fetch all documents in collection matching an ORM where clause, with optional ordering, offset (skip), and limit (take).

      Type Parameters

      • T = unknown

      Parameters

      • collection: string
      • where: Record<string | symbol, unknown> = {}
      • options: RavenFindOptions = {}

      Returns Promise<T[]>

    • Fetch the first document in collection matching an ORM where clause (respecting order), or null.

      Type Parameters

      • T = unknown

      Parameters

      • collection: string
      • where: Record<string | symbol, unknown> = {}
      • options: Omit<RavenFindOptions, "limit"> = {}

      Returns Promise<T | null>

    • Count documents in collection matching an ORM where clause.

      Parameters

      • collection: string
      • where: Record<string | symbol, unknown> = {}

      Returns Promise<number>

    • Store multiple documents in a single session/transaction (one saveChanges()). Returns the ids assigned to each document, in order.

      Parameters

      • collection: string
      • docs: Record<string, unknown>[]

      Returns Promise<string[]>

    • Insert-or-update by id: loads the document, merges doc into it if it exists, otherwise stores doc fresh - all in one session. Returns the id.

      Parameters

      • collection: string
      • doc: Record<string, unknown>
      • Optionalid: string

      Returns Promise<string>

    • Update every document in collection matching an ORM where clause, merging patch into each, in a single session/transaction. Returns the number of documents updated.

      Parameters

      • collection: string
      • where: Record<string | symbol, unknown>
      • patch: Record<string, unknown>

      Returns Promise<number>

    • Delete every document in collection matching an ORM where clause, in a single session/transaction. Returns the number of documents deleted.

      Parameters

      • collection: string
      • where: Record<string | symbol, unknown>

      Returns Promise<number>

    • Grouped aggregation over collection (count/sum/avg/min/max), with an optional ORM where pre-filter. Computed client-side over the matched documents so callers get standard GROUP BY-style results without hand-writing an RQL group by/index. Returns one entry per group: { group, ...aggregates }.

      Parameters

      • collection: string
      • options: RavenAggregateOptions = {}

      Returns Promise<Record<string, unknown>[]>

    • Run fn inside a single RavenDB session (unit of work), passing the session so multiple store/load/delete operations commit atomically with one saveChanges(). RavenDB sessions are ACID transactions, so this is the native way to make multi-document changes all-or-nothing.

      Type Parameters

      • T

      Parameters

      • fn: (session: any) => Promise<T>

      Returns Promise<T>