Given the following schema:
type Foo {
prop: PropType!
}
enum PropType {
A
B
C
...
}
I want to find all used values of PropType
in my current database.
E.g. when there are two nodes: {prop: A} , {prop: C}
I want to get [A,C]
as the result.
Note that there can be >10000 Foo
nodes in the database and the query shouldn’t take long.
Some options that come to my mind:
- Custom Query with DQL (does not respect
@auth
) - maintain a list of existing PropTypes (lots of overhead to remember (add, update, delete … ) → error-prone)
- query all
Foo
nodes and build the list on the client (over-fetching, potentially slow)
Do I have other possibilities?
How could I formulate this with DQL?