prorm API Reference
    Preparing search index...

    Class ArangoStore

    ArangoStore wraps the official arangojs driver's Database/ Collection/Graph/Cursor API in a typed, promise-based convenience layer covering document CRUD, AQL queries, graphs, and indexes.

    Implements

    Index
    name: "arangodb" = 'arangodb'

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

    library: "arangojs" = 'arangojs'

    The client library being used

    • arangojs's Database is a thin HTTP client wrapper with no persistent socket to open, so "connecting" here means constructing it and making one real request (version()) to fail fast on a bad URL/host/auth instead of only discovering the problem on the first real operation.

      Returns Promise<void>

    • Create an edge collection (documents store _from/_to and can be traversed as graph edges).

      Parameters

      Returns Promise<CollectionDescription>

    • Drop a collection (document or edge).

      Parameters

      • collectionName: string
      • Optionaloptions: DropCollectionOptions

      Returns Promise<boolean>

    • Whether a collection with this name exists.

      Parameters

      • collectionName: string

      Returns Promise<boolean>

    • List collections in the database (excludes system collections like _users by default).

      Parameters

      • excludeSystem: boolean = true

      Returns Promise<CollectionDescription[]>

    • Remove all documents from a collection without dropping the collection itself.

      Parameters

      • collectionName: string

      Returns Promise<void>

    • Number of documents currently in a collection.

      Parameters

      • collectionName: string

      Returns Promise<number>

    • Insert a single document. Pass _key in data to choose the key explicitly; otherwise ArangoDB generates one.

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • collectionName: string
      • data: DocumentData<T>
      • Optionaloptions: InsertDocumentOptions

      Returns Promise<DocumentMetadata & {} & { new?: Document<T> }>

    • Insert multiple documents in one request. Per-document failures (e.g. duplicate _key) come back as entries with error: true rather than throwing.

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • collectionName: string
      • data: DocumentData<T>[]
      • Optionaloptions: InsertDocumentOptions

      Returns Promise<
          (
              | DocumentOperationFailure
              | DocumentMetadata & {} & { new?: Document<T> }
          )[],
      >

    • Fetch a single document by key/id. Returns null if it does not exist (rather than throwing).

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • collectionName: string
      • selector: DocumentSelector
      • Optionaloptions: Omit<ReadDocumentOptions, "graceful">

      Returns Promise<Document<T> | null>

    • Fetch multiple documents by key/id. Entries for documents that don't exist come back as null.

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • collectionName: string
      • selectors: string[]

      Returns Promise<(Document<T> | null)[]>

    • Whether a document with this key/id exists in the collection.

      Parameters

      • collectionName: string
      • selector: DocumentSelector

      Returns Promise<boolean>

    • Partially update a document (shallow/deep merge of patch into the existing document, per ArangoDB's PATCH semantics).

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • collectionName: string
      • selector: DocumentSelector
      • patch: Patch<DocumentData<T>>
      • Optionaloptions: UpdateDocumentOptions

      Returns Promise<DocumentMetadata & {} & { new?: Document<T>; old?: Document<T> }>

    • Fully replace a document's content (unlike updateDocument, unspecified fields are dropped).

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • collectionName: string
      • selector: DocumentSelector
      • data: DocumentData<T>
      • Optionaloptions: ReplaceDocumentOptions

      Returns Promise<DocumentMetadata & {} & { new?: Document<T>; old?: Document<T> }>

    • Delete a single document by key/id.

      Parameters

      • collectionName: string
      • selector: DocumentSelector
      • Optionaloptions: RemoveDocumentOptions

      Returns Promise<DocumentMetadata>

    • Delete multiple documents by key/id in one request.

      Parameters

      • collectionName: string
      • selectors: string[]

      Returns Promise<(DocumentMetadata | DocumentOperationFailure)[]>

    • Run a parameterized AQL query and return the (cursor-based) result set as a native arangojs Cursor - iterate it with for await, cursor.next(), or cursor.all() to page through large result sets without loading everything into memory at once. Use @name in query for bind parameters and supply their values via bindVars (never string-interpolate untrusted values into query itself).

      Type Parameters

      • T = unknown

      Parameters

      • query: string
      • bindVars: Record<string, unknown> = {}
      • Optionaloptions: QueryOptions

      Returns Promise<Cursor<T>>

    • Convenience wrapper around query() that depletes the cursor and returns all results as an array.

      Type Parameters

      • T = unknown

      Parameters

      • query: string
      • bindVars: Record<string, unknown> = {}
      • Optionaloptions: QueryOptions

      Returns Promise<T[]>

    • Fetch all documents in collectionName matching an ORM where clause, with optional ordering, offset, and limit. The where object accepts the full ORM operator surface (Op.gt, Op.in, Op.between, Op.like, Op.and/Op.or, ...), compiled to a parameterized AQL FILTER (values and field names are always bound, never interpolated) - so standard queries never require hand-written AQL.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • collectionName: string
      • where: Record<string | symbol, unknown> = {}
      • options: ArangoFindOptions = {}

      Returns Promise<T[]>

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

      Type Parameters

      • T = Record<string, unknown>

      Parameters

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

      Returns Promise<T | null>

    • Count documents in collectionName matching an ORM where clause.

      Parameters

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

      Returns Promise<number>

    • Update every document in collectionName matching an ORM where clause, merging patch into each. Returns the updated documents (RETURN NEW).

      Type Parameters

      • T = Record<string, unknown>

      Parameters

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

      Returns Promise<T[]>

    • Remove every document in collectionName matching an ORM where clause. Returns the removed documents (RETURN OLD).

      Type Parameters

      • T = Record<string, unknown>

      Parameters

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

      Returns Promise<T[]>

    • Native AQL UPSERT: find a document matching search; if none exists insert insert, otherwise update the match with update (defaults to insert). Returns the resulting document (RETURN NEW).

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • collectionName: string
      • search: Record<string, unknown>
      • insert: Record<string, unknown>
      • Optionalupdate: Record<string, unknown>

      Returns Promise<T | null>

    • Grouped aggregation over collectionName using AQL's native COLLECT ... AGGREGATE (count/sum/avg/min/max), with an optional ORM where pre-filter. Returns one entry per group: { group, ...aggregates } (group is null when no groupBy is given).

      Parameters

      • collectionName: string
      • options: ArangoAggregateOptions = {}

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

    • Create a named graph over one or more edge definitions (each mapping an edge collection to the vertex collection(s) it connects from and to). Collections referenced by the edge definitions that don't exist yet are created automatically by ArangoDB.

      Parameters

      • graphName: string
      • edgeDefinitions: EdgeDefinitionOptions[]
      • Optionaloptions: CreateGraphOptions

      Returns Promise<GraphDescription>

    • Drop a graph. If dropCollections is true, also drops the graph's vertex/edge collections (as long as they aren't used by another graph).

      Parameters

      • graphName: string
      • dropCollections: boolean = false

      Returns Promise<boolean>

    • Whether a graph with this name exists.

      Parameters

      • graphName: string

      Returns Promise<boolean>

    • List all graphs in the database.

      Returns Promise<GraphDescription[]>

    • Add an existing (or new) vertex collection to a graph as an orphan collection (not tied to a specific edge definition).

      Parameters

      • graphName: string
      • collectionName: string

      Returns Promise<GraphDescription>

    • Add a new edge definition to an existing graph.

      Parameters

      • graphName: string
      • edgeDefinition: EdgeDefinitionOptions

      Returns Promise<GraphDescription>

    • Insert an edge document into an edge collection, connecting from and to (each a document _id, e.g. 'people/alice').

      Type Parameters

      • T extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • edgeCollectionName: string
      • from: string
      • to: string
      • data: T = ...
      • Optionaloptions: InsertDocumentOptions

      Returns Promise<DocumentMetadata & {} & { new?: Document<T> }>

    • Traverse a named graph from a start vertex using AQL's FOR v, e, p IN min..max DIRECTION start GRAPH graphName syntax, returning each visited vertex (v), the edge that reached it (e, null at depth 0), and the full path (p) as vertex/edge arrays.

      Type Parameters

      • V extends Record<string, unknown> = Record<string, unknown>
      • E extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • startVertexId: string

        Start vertex _id, e.g. 'people/alice'.

      • graphName: string

        Name of a graph created with createGraph().

      • options: TraverseOptions = {}

      Returns Promise<TraversalResult<V, E>[]>

    • Drop an index by id or name.

      Parameters

      • collectionName: string
      • selector: IndexSelector

      Returns Promise<boolean>

    • List all indexes on a collection (including the automatic primary/edge indexes).

      Parameters

      • collectionName: string

      Returns Promise<IndexDescription[]>

    • Fetch a single index's description by id or name.

      Parameters

      • collectionName: string
      • selector: IndexSelector

      Returns Promise<IndexDescription>