Looking for some help! Let’s say I’ve schema with...
# orm-help
p
Looking for some help! Let’s say I’ve schema with many to many relationship A and B with explicit called C. They already have data on both A and B, but not yet at C I want to update the data of A and B into C Q./ Which query method should I use? [set, connect, connectOrCreate, upsert, updatemany, ….]
r
As there’s no data on
C
you need to create a new relation. So
create
would work in this case:
Copy code
await prisma.A.update({
  { where: { id: 1 } },
  { C: { 
    create: { 
      // this will be an id from model B
      bId: b.id 
    }
  }
p
I’ll give a try, thank you!
👍 1