I started to play around with <a href="http://arangodb.com">ArangoDB</a> and used <a href="https://github.com/tariqdaouda/pyArango">Python</a> to get some data into my first database. Long story short: if you want to set your own key for the documents, do it on the document, not on the initialization data.
EDIT: this is only true for the most recent version 1.3.1 release on pypi by the time of writing ((See <a href="https://github.com/tariqdaouda/pyArango/issues/118">conversation on github</a> for details)).
<span id="more-4617"></span>
After setting up the connection with something like
```python
from pyArango.connection import Connection
import os
connection = Connection(
arangoURL=os.environ['ARANGODB_URL'],
username=os.environ['ARANGODB_USERNAME'],
password=os.environ['ARANGODB_PASSWORD']
)
```
**DO NOT** do
```python
json_data = {'foo': 'bar'}
json_data['_key'] = 'your_key'
doc = connection['your_database']['your_collection'].createDocument(initValues=json_data)
doc.save()
```
but **DO**
```python
json_data = {'foo': 'bar'}
doc = connection['your_database']['your_collection'].createDocument(initValues=json_data)
doc._key = 'your_key'
doc.save()
```
In the first case, the `_key` attribute is just ignored and the database creates a key automatically. The rational behind this probably is, that ArangoDB client should ignore all attributes that start with an underscore because they are used internally.
EDIT: I seemed to have been wrong. The intended behavior seems to always have been to set the key attribute even in the first of the two code samples above. More recent (currently unreleased) versions fixes this issue.