ArangoDB Query Language (or AQL) is a declarative querying language used inside the multi-model database ArangoDB.
Questions tagged [aql]
448 questions
2
votes
1 answer
Collect or group by date, ignoring the time
I have a list of task with a date property (ISO8601) and I want to group them by the date while ignoring the time set on the ISO8601.
FOR task IN tasks
COLLECT date = task.date INTO tasksInDate = task
SORT date DESC
RETURN {
…

janhartmann
- 14,713
- 15
- 82
- 138
2
votes
1 answer
AQL how to collect documents into arrays under their collection name?
In answer to previous questions was shown how to collect documents under their collection names but there was a clear constraint that query returns only one document for each collection.
@CoDEmanX asked what if the query returns many documents of…

kuza
- 2,761
- 3
- 22
- 56
2
votes
1 answer
How to solve Arango query promise error?
I have been trying to get a query result from Arangodb in to my front end service (Angular 4) using soap message. I am able to get a result of the query but printed out in console.log. But how can I get it under this function (Service).
So that I…

cantona_7
- 1,127
- 4
- 21
- 40
2
votes
2 answers
[ArangoDB]: Get the first element of an object?
I am trying to get the first element of the object scan. In my case, the first element's key changes. So I cannot call it with the key. Here is the AQL query I'm using, which is not working.
`FOR d in collection RETURN DISTINCT…

DeSpider
- 323
- 2
- 16
2
votes
0 answers
How to improve query efficiency
I have a problem I do not understand.For example, a cluster has three nodes,
each node is agent, coordinate, and dbserver, I execute an aql query on a node,The implementation plan is as follows:
Query string:
FOR v,p IN outbound
SHORTEST_PATH…

feitianStyle
- 119
- 3
2
votes
1 answer
Combining two queries in ArangoDB
I would like to retrieve all the documents connected to the vertex. I was able to do it using two different queries as mentioned below.
First all my idea is to find a vertex by using the information stored in it. I was able to do it with a full text…

cantona_7
- 1,127
- 4
- 21
- 40
2
votes
1 answer
Retrieving the documents connected this vertex
I would like to retrieve all documents connected to the vertex.
First all my idea was to find a vertex by using the information stored in it. I was able to do it with a full text query:
FOR doc IN spec
FILTER doc.serial_no == '"12345abc"'
RETURN…

cantona_7
- 1,127
- 4
- 21
- 40
2
votes
1 answer
Combining 2 result sets in AQL
Is there a way to combine 2 results sets (got via 2 different queries) into a single results set? Something like the following?
let results1 = (query1) // ["1","2"]
let results2 = (query2) // ["3","4"]
for r in MERGE_RESULTS(results1,results2)…

Sanka Darshana
- 1,391
- 1
- 23
- 41
2
votes
1 answer
ArangoDB AQL FILTER graph for matching edge attributes
I have one words collection and one word_relations edge collection. Words have relationships to other words, like synonym, hasPart, partOf, hasType, typeOf, etc.
I am trying to figure out how to FILTER an AQL graph query so that all paths are…

tgig
- 143
- 1
- 7
2
votes
1 answer
ArangoDB - Graph based recommender system
I am using ArangoDB and I am trying to build a graph-based recommender system with it.
The data model just contains users, items and ratings (edges).
Therefore want to calculate the affinity of a user to a movie with the katz measure.
Eventually I…

TJ3
- 21
- 1
2
votes
1 answer
ArangoDb AQL Graph queries traversal example
I am having some trouble wrapping my head around how to traverse a certain graph to extract some data.
Given a collection of "users" and a collection of "places".
And a "likes" edge collection to denote that a user likes a certain place. The "likes"…

Fouad
- 855
- 1
- 11
- 30
2
votes
1 answer
Filter on different graph edge types using ArangoDb AQL
Assuming I have the following document collections:
Students with names and student Id
Classes with name and class Id
Locations with name and location Id
and the following edge collections specifying the relationships:
StudentClass with _from and…

SteveC
- 644
- 7
- 12
2
votes
1 answer
AQL: Find all persons whose name occurs more than once and who are American
In ArangoDB, I have a collection 'people'. Each person has a name and a nationality.
How do I find the keys of all persons whose name occurs more than once and who are American?
I can run both queries separately.
Selecting all people whose name…

Elias Strehle
- 1,722
- 1
- 21
- 34
2
votes
1 answer
AQL: Partial match in array of strings
I have a table that looks like this:
{"_key": "1", "name": "George Washington", "cars": ["Ford Focus"]}
{"_key": "2", "name": "John Adams", "cars": ["Pontiac Firebird", "Toyota Corolla"]}
{"_key": "3", "name": "Thomas Jefferson", "cars": ["Toyota…

Elias Strehle
- 1,722
- 1
- 21
- 34
2
votes
1 answer
AQL: How to filter where NOT IN edge
TASK: Get random friend suggestions from User collection.
This is a User collection example:
{
"firstname": "John",
"lastname": "Doe",
"username": "johndoe",
"email": "john@doe.com"
}
I also have an edge collection friendRequest that stores…

Marios Frixou
- 227
- 2
- 9