ArangoDB v3.4 reached End of Life (EOL) and is no longer supported.

This documentation is outdated. Please see the most recent version here: Latest Docs

Collection API

These functions implement the HTTP API for manipulating collections.

The Collection API is implemented by all Collection instances, regardless of their specific type. I.e. it represents a shared subset between instances of DocumentCollection, EdgeCollection, GraphVertexCollection and GraphEdgeCollection.

Getting information about the collection

See the HTTP API documentation for details.

collection.exists

async collection.exists(): boolean

Checks whether the collection exists.

Examples

const db = new Database();
const collection = db.collection('some-collection');
const result = await collection.exists();
// result indicates whether the collection exists

collection.get

async collection.get(): Object

Retrieves general information about the collection.

Examples

const db = new Database();
const collection = db.collection('some-collection');
const data = await collection.get();
// data contains general information about the collection

collection.properties

async collection.properties(): Object

Retrieves the collection’s properties.

Examples

const db = new Database();
const collection = db.collection('some-collection');
const data = await collection.properties();
// data contains the collection's properties

collection.count

async collection.count(): Object

Retrieves information about the number of documents in a collection.

Examples

const db = new Database();
const collection = db.collection('some-collection');
const data = await collection.count();
// data contains the collection's count

collection.figures

async collection.figures(): Object

Retrieves statistics for a collection.

Examples

const db = new Database();
const collection = db.collection('some-collection');
const data = await collection.figures();
// data contains the collection's figures

collection.revision

async collection.revision(): Object

Retrieves the collection revision ID.

Examples

const db = new Database();
const collection = db.collection('some-collection');
const data = await collection.revision();
// data contains the collection's revision

collection.checksum

async collection.checksum([opts]): Object

Retrieves the collection checksum.

Arguments

Examples

const db = new Database();
const collection = db.collection('some-collection');
const data = await collection.checksum();
// data contains the collection's checksum