Reverse References
In both FlureeQL and GraphQL, you can follow a reference both forwards and backwards. For example, in previous lessons, we saw that chat/person
is a ref type. In order to see information about a person when we start from the chat
collection, we would issue a query like the following:
{
graph {
chat {
message
person {
handle
fullName
}
}
}
}
We can also see information about chats when we start from the person
collection. In order to do this, we need to include a predicate chat_Via_person
, and within the curly braces following chat_Via_person
, we specify any chat predicates we want displayed:
{
graph {
person {
chat_Via_person {
_id
instant
message
}
}
}
}
Write a Query!
Write a GraphQL query selecting `person/handle` and `person/fullName` starting from the `artist` collection.
Use the above query for reference.