You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/queries-aggregations/queries.adoc
-42Lines changed: 0 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,45 +69,3 @@ query {
69
69
}
70
70
}
71
71
----
72
-
73
-
== Undirected queries
74
-
75
-
All xref::/types/relationships.adoc[relationships] are created with a direction from one node to another.
76
-
By default, all queries follow the direction defined in the relationship.
77
-
However, in some cases it is necessary to query for all related nodes, regardless of the direction of the relationship.
78
-
This can be achieved with the argument `directed: false`.
79
-
80
-
For example, the following query should return all User friends, regardless of the direction of the relationship `"FRIENDS_WITH"`:
81
-
82
-
[source, graphql, indent=0]
83
-
----
84
-
query {
85
-
users {
86
-
name
87
-
friends: friends(directed: false) {
88
-
name
89
-
}
90
-
}
91
-
}
92
-
----
93
-
94
-
In addition, undirected relationships can also be used in the same fashion with connections.
95
-
For instance, this query is asking for a list of users and their friends' names with an undirected friendship connection:
96
-
97
-
[source, graphql, indent=0]
98
-
----
99
-
query Query {
100
-
users {
101
-
friendsConnection(directed: false) {
102
-
edges {
103
-
node {
104
-
name
105
-
}
106
-
}
107
-
}
108
-
}
109
-
}
110
-
----
111
-
112
-
Keep in mind that *undirected relationships are only supported in queries*.
113
-
The xref::/types/relationships.adoc#_querydirection[type definitions] for a relationship may define a different behavior, so the `directed` option may not be available in some cases.
0 commit comments