RJ
RJβ€’3y ago

Any hot tips for how to delete a set of

Any hot tips for how to delete a set of documents whose count is greater than 4096 (in prod environment)? Manually deleting thousands of documents is an unattractive solution (see screenshot) πŸ˜… I imagine I could write a mutation which would do so, deploy it, and run it, but is there an easier way? (I'm aware this may not be something you'd like to make easier)
No description
6 Replies
ari
ariβ€’3y ago
Hey RJ, the best way right now would likely be to write a mutation function that loops over your documents and calls db.delete on them. You may need to do this over multiple mutation calls if the table is large so the mutation doesn't timeout We definitely don't want it to be too easy to wipe out a table (and if you try to do so in prod, you'll get a warning), but it should still be possible from the dashboard. I'll file this as feedback!
RJ
RJOPβ€’3y ago
Great, thank you!
ari
ariβ€’3y ago
Also the suggestion in that error message looks so silly in context, thanks for flagging. I'm going to change it to something more useful for now πŸ™‚
RJ
RJOPβ€’3y ago
Hehe yes, sweet πŸ™‚
ballingt
ballingtβ€’3y ago
@RJ a couple other suggestions here, this is the kind of mutation that should probably have a secret key or require an ENV variable or similar, and heads up you can run mutations like this directly from the Dashboard by opening the console and using the convexFunctions global object
No description
RJ
RJOPβ€’3y ago
Oh that’s awesome! Thank you Tom!

Did you find this page helpful?