|
(Regarding the functionality described in SERVER-33121, marked as duplicate of this, to get back the deleted _id s from deleteMany .)
For comparison, PostgreSQL supports DELETE FROM ... RETURNING * | output_expression, which allows you to e.g. return the array of IDs that were deleted. (Or anything, for that matter.)
|
|
This would be a dream come true feature! In our case, the findAndModify looping is a terrible hassle and load-booster deluxe, as we have many users potentially updating the same records 'in parallel'. So far, our solution is sending a .find to retrieve the _id's of all documents matching the update selector, then run the update with multi:true, then run a find using $in:_idArray as a selector (as the original update selector could return different documents, depending on whether (a) other users ran updates in between or (b) the update changed selector fields. )
This is three complex actions instead of a 'simple' update multi:true that would return all affected documents. I imagine the update will have to read in every affected document anyways, so this would be a significant jump in both speed and usability for apps that need to run multi-updates within one request. Quite a large proportion i guess.
|