Saturday, 26 June 2021

ArangoDB: Databases, collections, Documents

Database is a set of collections, where each collection can store documents.


Comparing with RDBMS

Collection -> Table

Document -> Row, only difference here is, you will not define the columns in advance, a document can have arbitrary attribute keys and values.

 

Is documents in single collection should have same attributes?

No, Arango database does not impose this restriction.

 

Let’s login to example database using webui and experiment with it

 

Step 1: Open the url ‘http://127.0.0.1:8529’ in browser and login to webui of ArangoDB using username Krishna and password tiger (this setup I explained in my previous post).




Click on Login button.

 


 

Select ‘example’ database and click on the button ‘Select DB: example’.

 

Step 2: Click on the button ‘Add Collection’

 


Once you click on ‘Add Collection’ button, it opens a New Collection window. Enter Name as ‘user’ and select the type as Document.




Click on Save button.

 


Now you can see User collection is created.

 

Step 3: Create document inside user collection.

 

Click on user collection. Click the green circle with the white plus on the right-hand side to create a first document in this collection. It opens a Create document window.




Leave the field _key as blank (ArangoDB fill this with autogenerated key) and add following information in Document body.

 


 

Click on Create button. It will create new document and assign unique key to it.




In our case, 2892 is the auto generated key. _key property is immutable. Document _id would be user/2892.

 

Now go back to user collection, you will see that this document is created and listed.


 In the same way, you can create n number of documents.

 

Reference

https://www.arangodb.com/docs/stable/getting-started-databases-collections-documents.html

 

 


Previous                                                    Next                                                    Home

No comments:

Post a Comment