Self relation query is not returning any results


#1

Hi guys,

I have setup a type with a self relation (see below), with the aim to create a nested folder structure where the top item has no parent, but you can create sub-folders by providing the parent folder id

type Folder {
   id: ID!
   name: String!
   parent: Folder @relation(name: "FolderRelation")
}

I have then created the following two items

Top level with no parent

mutation {
  createFolder(data: {
    name: "Top level"
  }) {
    id
  }
}
ID of item created: cjvkag5n3006d0753eymur5pr

Sub-folder with the previously created folder as the parent

mutation {
  createFolder(data: {
    name: "Bottom level",
    parent: {
      connect: {
        id: "cjvkag5n3006d0753eymur5pr"
      }
    }
  }) {
    id
  }
}

Looking at the databrowser, this all looks correct, I can see the two new items with the “Bottom level” item correctly linked to the parent “Top level” item.
However when I run the following query in the playground I get an empty array of results

query {
  folders(where: {
    parent: {
      id: "cjvkag5n3006d0753eymur5pr"
    }
  }) {
    id
    name
  }
}
{
  "data": {
    "folders": []
  }
}

Am I doing something wrong? This has always worked until very recently when I updated to version 1.32.2

Thanks!


#2

I am also facing the similar issue.


#3

@jsrgnt

This is a bug.

I have created a github issue on this here: https://github.com/prisma/prisma/issues/4536


#4

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