Skip to the content.

Simple queries

These functions implement the HTTP API for simple queries.

collection.all

async collection.all([opts]): Cursor

Performs a query to fetch all documents in the collection. Returns a new Cursor instance for the query results.

Arguments

collection.any

async collection.any(): Object

Fetches a document from the collection at random.

collection.first

async collection.first([opts]): Array<Object>

Performs a query to fetch the first documents in the collection. Returns an array of the matching documents.

Warning: This method is not available when targeting ArangoDB 3.0 or later, see Compatibility.

Arguments

collection.last

async collection.last([opts]): Array<Object>

Performs a query to fetch the last documents in the collection. Returns an array of the matching documents.

Warning: This method is not available when targeting ArangoDB 3.0 or later, see Compatibility.

Arguments

collection.byExample

async collection.byExample(example, [opts]): Cursor

Performs a query to fetch all documents in the collection matching the given example. Returns a new Cursor instance for the query results.

Arguments

collection.firstExample

async collection.firstExample(example): Object

Fetches the first document in the collection matching the given example.

Arguments

collection.removeByExample

async collection.removeByExample(example, [opts]): Object

Removes all documents in the collection matching the given example.

Arguments

collection.replaceByExample

async collection.replaceByExample(example, newValue, [opts]): Object

Replaces all documents in the collection matching the given example with the given newValue.

Arguments

collection.updateByExample

async collection.updateByExample(example, newValue, [opts]): Object

Updates (patches) all documents in the collection matching the given example with the given newValue.

Arguments

collection.lookupByKeys

async collection.lookupByKeys(keys): Array<Object>

Fetches the documents with the given keys from the collection. Returns an array of the matching documents.

Arguments

collection.removeByKeys

async collection.removeByKeys(keys, [opts]): Object

Deletes the documents with the given keys from the collection.

Arguments

collection.fulltext

async collection.fulltext(fieldName, query, [opts]): Cursor

Performs a fulltext query in the given fieldName on the collection.

Arguments