Having fun with ArangoDB

Besides performance, strong consistency and scalability we also pick NoSQL DBs based on the Design of your Data this is one of the cool things about ArangoDB because it has multi-models.

ArangoDB is a distributed NoSQL database. It has a flexible data model for documents, graphs, and key-values this is also called multi-model db. ArangoDB has convenient SQL-like query language or JavaScript extensions.

In this post i will cover the Document Model and show some have code for such task i will use gradle and Java 8.  ArangoDB have drivers for lots of languages you check it out here.

I'm using ArangoDB in Ubuntu Linux, so to install you just do $ sudo apt-get install arangodb. If you are using another OS or Docker for instance is fine you check it out here as well.



Build.gradle

So first of all lets see the build.gradle file, here we are just adding ArangoDB Java Driver dependency. So it's very straightforward. Once you do this you can run $ gradle build and $ gradle eclipse to generate the eclipse project. Now let's see some Java code.

Java Driver

Now we will create a very simple DB and query a document using the Java Driver.

First we connect on the server running on localhost on port  8529. Next step is create a Database called db1. Moving forward there is a collection being created called myCollection in this collection there are several documents being add, as you can see us the Simpsons Family. To finish there is  query and a for loop to show all results.


You can then run $ gradle run . Full project is available in my GitHub.

That`s it :-)

Popular posts from this blog

Kafka Streams with Java 15

Rust and Java Interoperability

HMAC in Java