Type to use for edge document data. Defaults to any
.
Name of the collection.
Retrieves all documents in the collection.
Options for retrieving the documents.
Retrieves a random document from the collection.
Retrieves all documents in the collection matching the given example.
An object representing an example for documents.
Options for retrieving the documents.
Retrieves the collection checksum.
Options for retrieving the checksum.
Triggers compaction for a collection.
Retrieves information about the number of documents in a collection.
Creates a collection with the given options
and the instance's name.
See also Database.createCollection and Database.createEdgeCollection.
Note: When called on an EdgeCollection instance in TypeScript,
the type
option must still be set to the correct CollectionType.
Otherwise this will result in the collection being created with the
default type (i.e. as a document collection).
Options for creating the collection.
Retrieves the document matching the given key or id.
Throws an exception when passed a document or _id
from a different
collection, or if the document does not exist.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Options for retrieving the document.
Retrieves the document matching the given key or id.
Throws an exception when passed a document or _id
from a different
collection, or if the document does not exist.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
If set to true
, null
is returned instead of an
exception being thrown if the document does not exist.
Checks whether a document matching the given key or id exists in this collection.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Derives a document _id
from the given selector for this collection.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Retrieves the documents matching the given key or id values.
Throws an exception when passed a document or _id
from a different
collection, or if the document does not exist.
Array of document _key
, _id
or objects with either
of those properties (e.g. a document from this collection).
Options for retrieving the documents.
Deletes the collection from the database.
Options for dropping the collection.
Deletes the index with the given name or id
from the database.
Index name, id or object with either property.
Retrieves a list of all edges of the document matching the given
selector
.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Creates a persistent index on the collection if it does not already exist.
Options for creating the persistent index.
Creates a hash index on the collection if it does not already exist.
When using the RocksDB storage engine, hash indexes behave identically to persistent indexes.
Options for creating the hash index.
Creates a skiplist index on the collection if it does not already exist.
When using the RocksDB storage engine, skiplist indexes behave identically to persistent indexes.
Options for creating the skiplist index.
Creates a TTL index on the collection if it does not already exist.
Options for creating the TTL index.
Creates a multi-dimensional index on the collection if it does not already exist.
Options for creating the multi-dimensional index.
Creates a fulltext index on the collection if it does not already exist.
Options for creating the fulltext index.
Creates a geo index on the collection if it does not already exist.
Options for creating the geo index.
Checks whether the collection exists.
Retrieves statistics for a collection.
whether to return extended storage engine-specific details to the figures, which may cause additional load and impact performance
Retrieves a single document in the collection matching the given example.
An object representing an example for the document.
Performs a fulltext query in the given attribute
on the collection.
Name of the field to search.
Fulltext query string to search for.
Options for performing the fulltext query.
Retrieves general information about the collection.
Retrieves the shardId
of the shard responsible for the given document.
Document in the collection to look up the shardId
of.
Bulk imports the given data
into the collection.
The data to import, as an array of edge data.
Options for importing the data.
Bulk imports the given data
into the collection.
The data to import, as an array containing a single array of attribute names followed by one or more arrays of attribute values for each edge document.
Options for importing the data.
Bulk imports the given data
into the collection.
If type
is omitted, data
must contain one JSON array per line with
the first array providing the attribute names and all other arrays
providing attribute values for each edge document.
If type
is set to "documents"
, data
must contain one JSON document
per line.
If type
is set to "list"
, data
must contain a JSON array of
edge documents.
If type
is set to "auto"
, data
can be in either of the formats
supported by "documents"
or "list"
.
The data to import as a Buffer (Node), Blob (browser) or string.
Options for importing the data.
Retrieves a list of all incoming edges of the document matching the given
selector
.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Returns an index description by name or id
if it exists.
Index name, id or object with either property.
Returns a list of all index descriptions for the collection.
Retrieves a list of references for all documents in the collection.
The type of document reference to retrieve.
(MMFiles only.) Instructs ArangoDB to load the collection into memory.
Whether the number of documents in the collection should be included in the server response. Disabling this may speed up this process in future versions of ArangoDB.
Instructs ArangoDB to load the collection into memory.
Whether the number of documents in the collection should be included in the server response. Disabling this may speed up this process in future versions of ArangoDB.
(RocksDB only.) Instructs ArangoDB to load as many indexes of the collection into memory as permitted by the memory limit.
Retrieves all documents matching the given document keys.
An array of document keys to look up.
Retrieves a list of all outgoing edges of the document matching the given
selector
.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Retrieves the collection's properties.
Replaces the properties of the collection.
(RocksDB only.) Instructs ArangoDB to recalculate the collection's document count to fix any inconsistencies.
Removes an existing document from the collection.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Options for removing the document.
Removes existing documents from the collection.
Throws an exception when passed any document or _id
from a different
collection.
Documents _key
, _id
or objects with either of those
properties (e.g. documents from this collection).
Options for removing the documents.
Removes all documents in the collection matching the given example.
An object representing an example for the document.
Options for removing the documents.
Removes all documents matching the given document keys.
An array of document keys to remove.
Options for removing the documents.
Renames the collection and updates the instance's name
to newName
.
Additionally removes the instance from the Database's internal cache.
Note: Renaming collections may not be supported when ArangoDB is running in a cluster configuration.
The new name of the collection.
Replaces an existing document in the collection.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
The contents of the new document.
Options for replacing the document.
Replaces existing documents in the collection, identified by the _key
or
_id
of each document.
The documents to replace.
Options for replacing the documents.
Replaces all documents in the collection matching the given example.
An object representing an example for the documents.
Document data to replace the matching documents with.
Options for replacing the documents.
Retrieves the collection revision ID.
(MMFiles single-server only.) Rotates the journal of the collection.
Inserts a new document with the given data
into the collection.
The contents of the new document.
Options for inserting the document.
Inserts new documents with the given data
into the collection.
The contents of the new documents.
Options for inserting the documents.
Performs a traversal starting from the given startVertex
and following
edges contained in this edge collection.
Throws an exception when passed a document or _id
from a different
collection.
See also Graph.traversal.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
Options for performing the traversal.
Deletes all documents in the collection.
(MMFiles only.) Instructs ArangoDB to remove the collection from memory.
Updates an existing document in the collection.
Throws an exception when passed a document or _id
from a different
collection.
Document _key
, _id
or object with either of those
properties (e.g. a document from this collection).
The data for updating the document.
Options for updating the document.
Updates existing documents in the collection, identified by the _key
or
_id
of each document.
The data for updating the documents.
Options for updating the documents.
const db = new Database();
const collection = db.collection("friends");
await collection.save(
{
_key: "musadir",
_from: "users/rana",
_to: "users/mudasir",
active: true,
best: true
}
);
await collection.save(
{
_key: "salman",
_from: "users/rana",
_to: "users/salman",
active: false,
best: false
}
);
const result = await collection.updateAll(
[
{ _key: "musadir", active: false },
{ _key: "salman", active: true, best: true }
],
{ returnNew: true }
);
console.log(result[0].new.active, result[0].new.best); // false true
console.log(result[1].new.active, result[1].new.best); // true true
Updates all documents in the collection matching the given example.
An object representing an example for the documents.
Document data to update the matching documents with.
Options for updating the documents.
Generated using TypeDoc
Represents an edge collection in a Database.
See DocumentCollection for a more generic variant of this interface more suited for regular document collections.
See also GraphEdgeCollection for the type representing an edge collection in a Graph.
When using TypeScript, collections can be cast to a specific edge document data type to increase type safety.