Nested object call returning null


#1

Query returns null result for relation type, But I’ve connected object on that field. How to solve it?

My datamodel looks like this.

type User {
id: ID! @unique
name: String!

}

type Topic {
id: ID! @unique
title: String!
followers: [User!]!
}

When I query Topic from apollo server using prisma client , followers field returns null instead of User object. How to solve this?


#2

Hi @cellographic

You will need to implement a type resolver for relations, see: https://www.prisma.io/tutorials/a-guide-to-common-resolver-patterns-ct08/


#3

Thanks a lot. It’s working.


#4

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.