Support expand of types #3903
Labels
area/querylang
Issues related to the query language specification and implementation.
area/types
Issues related to the type system.
kind/feature
Something completely new we should consider.
status/accepted
We accept to investigate/work on it.
Milestone
Since v1.1.0 Dgraph support types and
expand(_all_)
is defined as the expansion of all the predicates found in all of the types linked to any of the nodes in the query.So for instance, if we have two types Person and Aged:
And we have the following dataset:
When we query all values of type
Person
and useexpand(_all_)
:we end up receiving the field
age
even though it's not part of the typePerson
becauseexpand(_all_)
expands all of the predicates in all of the types linked to any of the values returned.This is because our node
John Doe
is of typePerson
andAged
, as the result of the query shows.I propose a way to expand only the fields related to a type by passing the type name as the parameter to
expand
.So, we could send this query:
This would return only the fields
first_name
andlast_name
. We could also pass multiple types to the expand query:expand(Person, Aged)
and that would expand the union of the predicates.The text was updated successfully, but these errors were encountered: