Databases, Collections and Documents

Databases are sets of collections. Collections store records, which are referredto as documents. Collections are the equivalent of tables in RDBMS, anddocuments can be thought of as rows in a table. The difference is that you don’tdefine what columns (or rather attributes) there will be in advance. Everydocument in any collection can have arbitrary attribute keys andvalues. Documents in a single collection will likely have a similar structure inpractice however, but the database system itself does not impose it and willoperate stable and fast no matter how your data looks like.

Read more in the data-model concepts chapter.

For now, you can stick with the default system database and use the webinterface to create collections and documents. Start by clicking the_COLLECTIONS menu entry, then the Add Collection tile. Give it a name, e.g.users, leave the other settings unchanged (we want it to be a documentcollection) and Save it. A new tile labeled users should show up, whichyou can click to open.

There will be No documents yet. Click the green circle with the white pluson the right-hand side to create a first document in this collection. A dialogwill ask you for a key. You can leave the field blank and click _Create tolet the database system assign an automatically generated (unique) key. Notethat the _key property is immutable, which means you can not change it oncethe document is created. What you can use as document key is described in thenaming conventions.

An automatically generated key could be "9883" (key is always a string!),and the document _id would be "users/9883" in that case. Aside from a fewsystem attributes, there is nothing in this document yet. Let’s add a customattribute by clicking the icon to the left of (empty object), then _Append.Two input fields will become available, FIELD (attribute key) and VALUE(attribute value). Type name as key and your name as value. Append anotherattribute, name it age and set it to your age. Click Save to persist thechanges. If you click on Collection: users at the top on the right-hand sideof the ArangoDB logo, the document browser will show the documents in theusers collection and you will see the document you just created in the list.