#✅ - Can not access the comments data from post model using @hasMany relationship

5 messages · Page 1 of 1 (latest)

sage delta
#

`||// get post
const result = await client.graphql({
query: getPost,
variables: { id: post.id }
});

  const postWithComments = result.data.getPost;
  
  console.log("result.data.createPost ", postWithComments?.comments);

||`
**console results **
result.data.createPost {"__typename": "ModelCommentConnection", "nextToken": null}

viral prairie
#

Hi @sage delta can you share your schema?

#

Also, do you get a different result if you perform the same query from the AppSync console?

sage delta
#

Thanks for reply but i solve that by passing items to the queries of getPost

celest owlBOT
#

✅ - Can not access the comments data from post model using @hasMany relationship