Is it possible to automatically update / delete two documents in MongoDB, causing a new update / delete call from the first update callback? In the example below, I want to remove the second document from the collection, but only if the update of the first document is successfully completed:
db.collection.update(conditions1, {$set: set}, function (err,result){ db.collection.remove(conditions2, function(err,doc_num){ db.close(); )}; });
I come across the operator of $ isolated requests, but from what I understand in the documentation, this operator is used to perform read / write locks on one request that affects several documents, and not when reading / writing, block one document after updating on another document using the first document update callback that I want to try and execute.
source share