With the method query() you can run AQL:

ArangoDB arango = new ArangoDB.Builder().build();
ArangoCursor<BaseDocument> cursor = arango.db().query("FOR p IN Person 
FILTER p.name == 'myname' RETURN { name: p.name }", null, null, BaseDocument
.class);

Instead of BaseDocument you can use Map<String, Object> or any java POJO 
that represents your query result or just String/Integer/Double if your 
query returns only a single field and not your whole documents.

I also would suggest to use bind parameters 
<https://docs.arangodb.com/3.2/AQL/Fundamentals/BindParameters.html> to 
separate the query text with your literal values in the query:

ArangoDB arango = new ArangoDB.Builder().build();
Map<String, Object> bindVars = new MapBuilder().put("name", "myname").get();
ArangoCursor<BaseDocument> cursor = arango.db().query("FOR p IN Person 
FILTER p.name == @name RETURN { name: p.name }", bindVars, null, 
BaseDocument.class);




Am Samstag, 28. Oktober 2017 15:03:37 UTC+2 schrieb Hossein Ghiyasi Mehr:
>
> I have a collection called "*Person*". Each person has an attribute 
> called "*name*". By below query in *Arango Web Interface*, I can get 
> person which has special *p.name <http://p.name>*:
>
> FOR p IN Person
> FILTER *p.name <http://p.name> == 'myname'*
>  RETURN {
>    name: p.name
>  }
>
> How can I run top query in JAVA?
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to