To clean up my database, I run a script that deletes some documents. This script needs the declareUpdate() statement to be able to delete documents. But this causes extreme calculation times.
For example: the following never finishes with declareUpdate() in the script.
cts.remainder(fn.subsequence(fn.collection("deleteThis"), 1, 1))
This runs in a second without the declareUpdate(). Is it maybe checking all the reader/writer permissions on all the documents in cts.remainder?
No, fn.collection reaches all docs in that collection, and in update mode uri read locks are applied for all of them. You are better off using cts.uris with a collection query, and then batch delete the docs in spawns..
HTH!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With