Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Collection<T>

The Collection type represents a collection in a Database.

When using TypeScript, collections can be cast to DocumentCollection or EdgeCollection in order to increase type safety.

example
interface Person {
  name: string;
}
interface Friend {
  startDate: number;
  endDate?: number;
}
const db = new Database();
const documents = db.collection("persons") as DocumentCollection<Person>;
const edges = db.collection("friends") as EdgeCollection<Friend>;

Type parameters

  • T: object

    Type to use for document data. Defaults to any.

Hierarchy

  • Collection

Implements

Index

Accessors

isArangoCollection

  • get isArangoCollection(): true
  • Returns true

name

  • get name(): string
  • Returns string

Methods

all

any

  • any(): Promise<any>

byExample

checksum

count

  • count(): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number } & { count: number }>
  • Returns Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number } & { count: number }>

create

document

documentExists

documentId

drop

dropIndex

edge

  • Parameters

    Returns Promise<T & { _id: string; _key: string; _rev: string } & { _from: string; _to: string }>

edges

ensureIndex

exists

  • exists(): Promise<boolean>

figures

  • figures(): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number } & { count: number } & { figures: { alive: { count: number; size: number }; attributes: { count: number; size: number }; compactionStatus: { bytesRead: number; bytesWritten: number; count: number; filesCombined: number; message: string; time: string }; compactors: { count: number; fileSize: number }; datafiles: { count: number; fileSize: number }; dead: { count: number; deletion: number; size: number }; documentReferences: number; indexes: { count: number; size: number }; journals: { count: number; fileSize: number }; lastTick: number; shapefiles: { count: number; fileSize: number }; shapes: { count: number; size: number }; uncollectedLogfileEntries: number; waitingFor: string } }>
  • Returns Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number } & { count: number } & { figures: { alive: { count: number; size: number }; attributes: { count: number; size: number }; compactionStatus: { bytesRead: number; bytesWritten: number; count: number; filesCombined: number; message: string; time: string }; compactors: { count: number; fileSize: number }; datafiles: { count: number; fileSize: number }; dead: { count: number; deletion: number; size: number }; documentReferences: number; indexes: { count: number; size: number }; journals: { count: number; fileSize: number }; lastTick: number; shapefiles: { count: number; fileSize: number }; shapes: { count: number; size: number }; uncollectedLogfileEntries: number; waitingFor: string } }>

firstExample

  • firstExample(example: Partial<DocumentData<T>>): Promise<any>

fulltext

  • fulltext(attribute: string, query: string, __namedParameters?: { index: undefined | string; options: options }): Promise<ArrayCursor<any>>
  • Parameters

    • attribute: string
    • query: string
    • Default value __namedParameters: { index: undefined | string; options: options } = {}
      • index: undefined | string
      • options: options

    Returns Promise<ArrayCursor<any>>

get

  • get(): Promise<any>

getResponsibleShard

  • getResponsibleShard(document: Partial<Document<T>>): Promise<string>

import

inEdges

index

indexes

  • indexes(): Promise<any>

list

load

  • load(count?: undefined | false | true): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { count: number }>
  • Parameters

    • Optional count: undefined | false | true

    Returns Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { count: number }>

loadIndexes

  • loadIndexes(): Promise<boolean>

lookupByKeys

  • lookupByKeys(keys: string[]): Promise<any>

outEdges

properties

  • properties(properties?: CollectionPropertiesOptions): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number }>
  • Parameters

    Returns Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number }>

recalculateCount

  • recalculateCount(): Promise<boolean>

remove

removeAll

removeByExample

removeByKeys

rename

  • rename(newName: string): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType }>

replace

replaceAll

replaceByExample

revision

  • revision(): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number } & { revision: string }>
  • Returns Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType } & { distributeShardsLike?: undefined | string; doCompact?: undefined | false | true; indexBuckets?: undefined | number; isVolatile?: undefined | false | true; journalSize?: undefined | number; keyOptions: CollectionKeyProperties; minReplicationFactor: number; numberOfShards?: undefined | number; replicationFactor?: undefined | number; shardKeys?: string[]; shardingStrategy?: ShardingStrategy; smartJoinAttribute?: undefined | string; statusString: string; validation: ValidationProperties | null; waitForSync: boolean; writeConcern: number } & { revision: string }>

rotate

  • rotate(): Promise<boolean>

save

saveAll

traversal

truncate

  • truncate(): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType }>

unload

  • unload(): Promise<{ code: number; error: false } & { globallyUniqueId: string; isSystem: boolean; name: string; status: CollectionStatus; type: CollectionType }>

update

updateAll

updateByExample

Generated using TypeDoc