DevStronauT
DevStronauT6mo ago

Delete a document by multiple fields??

Hey I've this schema for one of my table! name: v.string(), email: v.string(), imgUrl: v.string(), document: v.id("documents"), We can delete the document using ctx.db.delete(id); But I want to delete document where email=something and document=something How to achieve this??
2 Replies
Michal Srb
Michal Srb6mo ago
_id is unique. But if you want to delete based on one or more other fields, you can add an index for fast lookup, and then load the document with that index and delete it via its ._id. #ask-ai might be able to help you translate from SQL to convex queries and mutations.
DevStronauT
DevStronauTOP6mo ago
Hey I get it resolved Thanks @Michal Srb !

Did you find this page helpful?