<https://github.com/prisma/prisma/issues/2036>
# orm-help
I have a update from in the UI where if I change the product category I need to disconnect the old one
I am having a ton of usecases for this kind of mutations
Is there any way currently from which I may prevent a db call to prisma to set the new relations from start
PS:I always forget about threads 😅
Do I have to call the db rn, @nilan due to the limitations of current api?
n
I honestly don't understand what you're saying and asking 🙂
h
Ok let me explain in more detail
I have a product field in my datamodel like so
Copy code
type Product {
  id: ID! @unique
  user: User
  price: Int!
  saleprice: Int!
  description: String!
  alternative_images: [Alternative_images!]!
  createdAt: DateTime!
  images: [Images!]!
  name: String!
  brandName: String
  product_attributes: [Product_attributes!]!
  product_categories: [Product_categories!]!
  product_tags: [Product_tags!]!
  sizeQties: [SizeQty!]!
  slug: String! @unique
  updatedAt: DateTime!
}
See the product_categories field, In the admin section for the seller we wanna allow them to change the category in the edit form
Now when we update we have no way to disconnect all of the old stuff without querying the db and grab the product, the set operator operator proposed in this issue(I guess by you @nilan) would have solved this use case https://github.com/prisma/prisma/issues/2036
Now I am asking if querying is the most efficient way to do this rn without the set operator?
n
yes, it is.
h
Ok and is there any ETA for set operator cause that issue is not being addressed since march and many other users have this usecase as seen in the issue
n
No, there is no ETA.
h
Ok I believe that graphcool had this kind of operator(If I remember correctly), any ways will query the db now and pass the ids to disconnect
Thanks for answering 👍
n
No, it didn't. The way connecting/disconnecting works in Graphcool is quite different, so replacing is way easier, but adding single elements is more difficult than in Prisma.
h
oh 😮
n
cc @weakky 😄
👼 2
w
@Harshit If you manage to come up with a more elegant solution, please share it !
h
Ya surely will
Also I wanted to ask I am posting all of the data from my form so is there any need for me to filter out only the fields that were updated as you doing your code, cause I was thinking of passing it all to the update @weakky
or @nilan
I guess that will save me some lines of code will try
n
feel free to ask a proper question in the forum: https://www.prisma.io/forum/c/questions 🙂 I can't answer one question after another like that here
and please don't highlight people excessively, it's kind of rude
h
ok
sorry
n
no worries at all 🙂
h
Solved finally by using delete on all of them
👌 1
v
I did that for a similar relation, ended up deleting, then creating/connecting. Set would make a lot of sense in this case.