EmbeddedDocumentField list field has not been detected in GraphiQL
jawahar273 opened this issue · 2 comments
jawahar273 commented
Graphene monogo document say ListField is supported. But when i try to get data from monogo, the graphql throws error given below. This is snippet from my original code.
Note: Sometime the tags list can be empty.
# GraphQL Defination
class BarModel(mongoengine.EmbeddedDocument):
language = mongoengine.StringField()
tags = mongoengine.ListField()
class FooModel(mongoengine.Document):
meta = {"collection": "collection_name"}
title = mongoengine.StringField(required=True)
meta_data = mongoengine.EmbeddedDocumentField(BarModel)
class Bar(MongoengineObjectType):
class Meta:
model = BarModel
inferfaces = (Node,)
class Foo(MongoengineObjectType):
class Meta:
model = FooModel
interfaces = (Node,)
def resolve_meta_data(parent, info, **kwargs):
return FooModel.objects.get(id=parent.id).meta_data
{
"data": null,
"errors": [
{
"message": "Cannot query field \"tags\" on type \"Bar\".",
"locations": [
{
......
}
]
}
]
}
abawchen commented
@jawahar273 : Would you please provide your query string as well? Thanks.
jawahar273 commented
# GraphQL query string
{
Foo(first: 5) {
edges {
cursor
node {
title
id
bar {
tags
}
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
}