Document

class pyArango.document.DocumentStore(collection, validators=None, initDct=None, patch=False, subStore=False, validateInit=False)[source]

Store all the data of a document in hierarchy of stores and handles validation. Does not store private information, these are in the document.

getPatches()[source]

get patches as a dictionary

getStore()[source]

get the inner store as dictionary

resetPatch()[source]

reset patches

set(dct)[source]

Set the store using a dictionary

validate()[source]

Validate the whole document

validateField(field)[source]

Validatie a field

class pyArango.document.Document(collection, jsonFieldInit=None, on_load_validation=False)[source]

The class that represents a document. Documents are meant to be instanciated by collections

delete()[source]

deletes the document from the database

forceSave(**docArgs)[source]

saves even if the document has not been modified since the last save

getEdges(edges, inEdges=True, outEdges=True, rawResults=False)[source]

returns in, out, or both edges linked to self belonging the collection ‘edges’. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects

getInEdges(edges, rawResults=False)[source]

An alias for getEdges() that returns only the in Edges

getOutEdges(edges, rawResults=False)[source]

An alias for getEdges() that returns only the out Edges

getPatches()[source]

return the patches in a dict format

getResponsibleShard()[source]

If we’re working with an arangodb cluster, we can use this method to fetch where a document lives.

getStore()[source]

return the store in a dict format

patch(keepNull=True, **docArgs)[source]

Saves the document by only updating the modified fields. The default behaviour concening the keepNull parameter is the opposite of ArangoDB’s default, Null values won’t be ignored Use docArgs for things such as waitForSync = True

reset(collection, jsonFieldInit=None, on_load_validation=False)[source]

replaces the current values in the document by those in jsonFieldInit

save(waitForSync=False, **docArgs)[source]

Saves the document to the database by either performing a POST (for a new document) or a PUT (complete document overwrite). If you want to only update the modified fields use the .patch() function. Use docArgs to put things such as ‘waitForSync = True’ (for a full list cf ArangoDB’s doc). It will only trigger a saving of the document if it has been modified since the last save. If you want to force the saving you can use forceSave()

saveCopy()[source]

saves a copy of the object and become that copy. returns a tuple (old _key, new _key)

set(fieldDict)[source]

set the document with a dictionary

setPrivates(fieldDict)[source]

will set self._id, self._rev and self._key field.

to_default()[source]

reset the document to the default values

validate()[source]

validate the document

class pyArango.document.Edge(edgeCollection, jsonFieldInit=None, on_load_validation=False)[source]

An Edge document

An alias to save that updates the _from and _to attributes. fromVertice and toVertice, can be either strings or documents. It they are unsaved documents, they will be automatically saved.

reset(edgeCollection, jsonFieldInit=None, on_load_validation=False)[source]

replaces the current values in the document by those in jsonFieldInit

save(**edgeArgs)[source]

Works like Document’s except that you must specify ‘_from’ and ‘_to’ vertices before. There’s also a links() function especially for first saves.