I am using MongoDB Stitch to build the backend for my app. I noticed that deleteMany() operation in MongoDB Stitch is very slow and whenever I have to delete a huge number of documents (500+) then I get “Execution Time out error”. I see that MongoDB Stitch operations don’t run longer than 90s. Any good workarounds or solutions to this?
Did you try “remove”?
Hi @Salman_Alam, welcome!
I have to delete a huge number of documents (500+) then I get “Execution Time out error”
Are you able to distribute the delete operations ? i.e. instead of 500+ documents in a X period of time, do X/5 period of time. Performing smaller number of delete operations but more frequent.
Alternatively, depending on your use case, see also Expire Data From Collections by Setting TTL.