Я использую django в качестве серверной части с mongoDB, и я пытаюсь получить различные значения с Graphql, но я получаю эту ошибку:
"message": "Received incompatible instance \"{'subreddit': 'politics', 'score': 75799}\"."
Вот мой schema.py :
class TopicType(DjangoObjectType):
class Meta:
model = Topic
class Query(graphene.ObjectType):
all_topics = graphene.List(TopicType)
topic = graphene.Field(lambda:
graphene.List(TopicType),subreddit=graphene.String(),score=graphene.String())
def resolve_all_topics(self, info,**kwargs):
return Topic.objects.all()
def resolve_topic(self,info,**kwargs):
return Topic.objects.values("subreddit").order_by().annotate(score =Sum("score"))
schema = graphene.Schema(query=Query)
А вот и мой запрос
query getTopics{
topic {
subreddit
}}