Current behavior
If we connect many to many self relation from A to B, we will get A related to B, but B is not related to A.
Reproduction
Database Shema
type Post {
id: ID! @unique
related: [Post!]! @relation(name: "RelatedPosts")
}
For example we have 2 post A with id cjbz2h6eej5gf0113ow5par0d and and post B with id cjda754u0vlfu01850l4hw31t. Now let connect them together
mutation {
updatePost (
id: "cjbz2h6eej5gf0113ow5par0d"
data: {
related: {
connect: {
id: "cjda754u0vlfu01850l4hw31t"
}
}
}
) {
id
related {
id
}
}
}
the result
{
"data": {
"updatePost": {
"id": "cjbz2h6eej5gf0113ow5par0d",
"related": [
{
"id": "cjda754u0vlfu01850l4hw31t"
}
]
}
}
}
Query A we have
{
"data": {
"movie": {
"id": "cjbz2h6eej5gf0113ow5par0d",
"related": [
{
"id": "cjda754u0vlfu01850l4hw31t"
}
]
}
}
}
Query B we have
{
"data": {
"movie": {
"id": "cjda754u0vlfu01850l4hw31t",
"related": []
}
}
}
Expected behavior?
B should have A in related field
{
"data": {
"movie": {
"id": "cjda754u0vlfu01850l4hw31t",
"related": [
{
"id": "cjbz2h6eej5gf0113ow5par0d"
}
]
}
}
}
What is your prisma version and your prisma cluster list?
I use prisma 1.5.1
The cluster I use is prisma-us1 1.5.1
Hey @kieusonlam thanks for reporting this. I can reproduce it. It looks like the relation data is correctly being created, but we resolve it incorrectly during the query.