= ArangoDb Component
:doctitle: ArangoDb
:shortname: arangodb
:artifactid: camel-arangodb
:description: Perform operations on ArangoDb when used as a Document Database, or as a Graph Database
:since: 3.5
:supportlevel: Stable
:component-header: Only producer is supported
//Manually maintained attributes
:camel-spring-boot-name: arangodb

*Since Camel {since}*

*{component-header}*

The ArangoDb component is a ArangoDb client that uses the https://github.com/arangodb/arangodb-java-driver[arango java driver] to perform queries on collections and graphs in the ArangoDb database.

Maven users will need to add the following dependency to their `pom.xml`
for this component:

[source,xml]
------------------------------------------------------------
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-arangodb</artifactId>
    <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>
------------------------------------------------------------


== URI format

[source,java]
---------------------------
arangodb:database[?options]
---------------------------

// component-configure options: START

// component-configure options: END

// component options: START
include::partial$component-configure-options.adoc[]
include::partial$component-endpoint-options.adoc[]
// component options: END

// endpoint options: START

// endpoint options: END

// component headers: START
include::partial$component-endpoint-headers.adoc[]
// component headers: END

== Examples

=== Producer Examples

==== Save document on a collection

[source,java]
--------------------------------------------------------------------------------
from("direct:insert")
  .to("arangodb:testDb?documentCollection=collection&operation=SAVE_DOCUMENT");
--------------------------------------------------------------------------------

And you can set as body a BaseDocument class 

--------------------------------------------------------------------------------
BaseDocument myObject = new BaseDocument();
myObject.addAttribute("a", "Foo");
myObject.addAttribute("b", 42);
--------------------------------------------------------------------------------

==== Query a collection

[source,java]
--------------------------------------------------------------------------------
from("direct:query")
  .to("arangodb:testDb?operation=AQL_QUERY
--------------------------------------------------------------------------------

And you can invoke an AQL Query in this way

--------------------------------------------------------------------------------
String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.value == @value";
Map<String, Object> bindVars = new MapBuilder().put("value", "hello")
        .get();

Exchange result = template.request("direct:query", exchange -> {
    exchange.getMessage().setHeader(AQL_QUERY, query);
    exchange.getMessage().setHeader(AQL_QUERY_BIND_PARAMETERS, bindVars);
});
--------------------------------------------------------------------------------


include::spring-boot:partial$starter.adoc[]
