In python-arango, a document is a Python dictionary that is JSON serializable and can be nested to an arbitrary depth.
Key properties include:
_key: A unique identifier for the document within a specific collection._id (the handle): A unique identifier across all collections in a database, formatted as {collection}/{key}._rev: The current revision of the document, used for MVCC (Multiple Version Concurrency Control). This is populated by ArangoDB.
Edge documents (edges) are a special type of document used in edge collections. They are similar to standard documents but must include two additional required fields:
_from: The handle of the source vertex._to: The handle of the target vertex.
# Example of a standard document
{
'_id': 'students/bruce',
'_key': 'bruce',
'_rev': '_Wm3dzEi--_',
'first_name': 'Bruce',
'last_name': 'Wayne',
'address': {
'street' : '1007 Mountain Dr.',
'city': 'Gotham',
'state': 'NJ'
},
'is_rich': True,
'friends': ['robin', 'gordon']
}
# Example of an edge document
{
'_id': 'friends/001',
'_key': '001',
'_rev': '_Wm3d4le--_',
'_from': 'students/john',
'_to': 'students/jane',
'closeness': 9.5
}