How to delete entities?

I've gone through the basic tutorial and I want to keep going in order to learn. How would I go about deleting a prisma entry? In this context, deleting one of the to-do tasks. I imagine the structure would have to look something like this: export const deleteTask = async (args, context) => { return context.entities.Task.delete({ where: { id: args.taskId }, data: {} }) } Thank you!
3 Replies
Fecony
Fecony2y ago
Hey @PabloIL You are right, but you don't need to pass data BTW, Prisma recently introduced playground where you can see examples of different scenarios how to use it. Here is an example of delete https://playground.prisma.io/examples/writing/delete/delete You can reference it to learn different things in prisma itself 🐝
Prisma Playground | Learn the Prisma ORM in your browser
Prisma Playground | Learn the Prisma ORM in your browser
The Playground is an interactive learning environment for Prisma. Learn how to send database queries and explore migrations workflows with the Prisma ORM.
PabloIL
PabloIL2y ago
Thank you! I have trouble sometimes knowing what software is handling what and I don't know what documentation to look into!
shayne
shayne2y ago
Good question, @PabloIL! And thanks for the help here, @Fecony! They are right, Prisma is doing the heavy lifting in the ORM layer. 🦾 If you have specific questions around any CRUD DB operations, the Prisma docs are generally pretty good. But we can help with snippets, too!
Want results from more Discord servers?
Add your server