Closed shaozi closed 2 years ago
yep, you should be able to use a list, like so:
class Ship(graphene.ObjectType):
names = graphene.List(graphene.String())
then query it like:
{
ship(...) { names }
}
resulting in:
{
"data": {"ship": {"names": [item1, item2, ...]}}
}
That is great! I did not think of that it could be so easy!
What about many to many relationship?
@shaozi it should work exactly the same for a many to many relationship, just use a list on the other side of the relationship as well.
class Destination(graphene.ObjectType)
name = graphene.String()
ships = graphene.List(Ship)
class Ship(graphene.ObjectType):
destinations = graphene.List(Destination)
For using plain Strings, you would have to create an extra ObjectType.
I'm closing this issue, since the problem seems to be solved. Feel free to reply again or open another Issue if you experience further problems.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.
Relay pagination is nice, but sometimes, I just want to have a simple list backref. I know it will not exceed more than 10 elements in the list. so pagination just added a layer of extra work and no benefits.
Is there a way to disable relay pagination?