Since transactions have been added in 2018, which work across collections (https://www.mongodb.com/docs/manual/core/transactions/) and across shards (https://www.mongodb.com/docs/manual/core/transactions-sharded-clusters/), shouldn't cascading deletes be possible now? I only worked with sql transactions in the past, but my intuition would be that it should be fairly easy to do this in a client:
1. start a transaction
2. fetch document
3. look for dbref fields
4. fetch those docs
5. continue at 2 until all docs have been found, stopping at branches when a doc has already been fetched
6. go back in reverse and delete all of them
7. commit transaction
If this is possible to do in a client, it should be possible to do on the server as well, shouldn't it?
Old and possibly outdated feature request: https://jira.mongodb.org/browse/SERVER-1298?signupSource=Account