I am going through the tutorial on Arangodb which is using a sample game of thrones dataset. I am trying to figure out how I would be able to filter out characters based on a trait?
INSERT {
"name": "Ned",
"surname": "Stark",
"alive": true,
"age": 41,
"traits": ["A","H","C","N","P"]
} INTO Characters
I am trying to use the following code but its not working. Would the above traits be an array. if so how do I proceed?
for c in Characters
Filter c.traits =="A"
RETURN c
Thank you!
If you want to find all characters that have trait "A" you can use FILTER "A" IN c.traits
, ie, the characters may also have other traits. If you want to find characters that have only trait "A" you can use FILTER c.trait == ["A"]
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.