Collections are something similar to tables in SQL databases world. A Collection is a group of documents and Edges.

It’s quite easy to create collection:

from arango import create

# here we define connection to Arango
c = create(db="test")

# make sure database exists

# here we creating collection explicitly

assert len(c.collections()) == 1

# here we creating edges collection

assert len(c.collections()) == 2

Collection test being created.


It’s not necessary to create collection before adding documents to it. You can specify createCollection as keyed argument during creation of new Document

If you don’t want to create collection explicitly use

# here we creating document AND collection
c.test.documents.create({"sample": 1}, createCollection=True)

Get list of collections

To get list of Collections simply call connection like c()

For example:

# here we are creating collection explicitly

assert c(), ["test"]
class arango.collection.Collections(connection)

connection) for Collections

__call__(*args, **kwargs)

Return list of collections within current database


Accessible as property by default.


In case property used internally by Collections it’s possible to use dict-like interface, for example .database used internally as link to database instance but feel free to use dict-like interface to create collection with name database: voca["database"]


Arango DB provide rich API to manipulate collections Collection instance methods are quite rich. Here is documentation which describes Collections REST Api

class arango.collection.Collection(connection=None, name=None, id=None, createCollection=True, response=None)

Represent single collection with certain name


Exactly the same as count but it’s possible to use in more convenient way


assert c.test.count() == len(c.test)

Get collection name


Get count of all documents in collection

create(waitForSync=False, type=2, **kwargs)

Create new Collection. You can specify waitForSync argument (boolean) to wait until collection will be synced to disk

create_edges(*args, **kwargs)

Create new Edges Collection - sepcial kind of collections to keep information about edges.


Delete collection


Get Documents related to Collection.

Technically return instance of Documents for Collection instance object


Get Edges related to Collection.

Technically return instance of Edges for Collection instance object

If this method used to query edges (or called with no arguments) it may generated exceptions:

  • DocumentIncompatibleDataType

    In case you’re not provided VERTEX of the Edge which should be instance or subclass od Document

    More about DocumentIncompatibleDataType


Get Indexes related to Collection


Get information about collection. Information returns AS IS as raw Response data


Load collection into memory


Set or get collection properties.

If **props are empty eq no keyed arguments specified then this method return properties for current Collection.

Otherwise method will set or update properties using values from **props


Create Query Builder for current collection.

c.test.create(){"name": "sample"})

assert len(c.test.query.execute()), 1

Change name of Collection to name.

Return value is bool if success or error respectively.

This method may raise exceptions:

  • InvalidCollection

    This one may be generated only in case very low-level instantiation of Collection and if base collection proxy isn’t provided More about InvalidCollection

  • CollectionIdAlreadyExist

    If Collection with new name already exist this exception will be generated. More about CollectionIdAlreadyExist

  • InvalidCollectionId

    If Collection instantiated but name is not defined or not set. More about InvalidCollectionId

Sample usage:


assert "test2" in c()

Truncate current Collection


Unload collection from memory