[SERVER-33121] Add updated/deleted _id's to response object of updateMany and deleteMany Created: 05/Feb/18 Updated: 09/Feb/18 Resolved: 09/Feb/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.6.0, 3.6.1, 3.6.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Dexter Esajas | Assignee: | David Storch |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Sprint: | Query 2018-02-12 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
When running the following code (in Node.js):
the response object does not show me which records have been updated. Could you please add an array named something like: "modifiedIds" containing all _id's of the records that have been updated. Please also see my stackoverflow question for aditional information and the example. |
| Comments |
| Comment by Dexter Esajas [ 09/Feb/18 ] |
|
Hi david.storch Thank you for your response, this is indeed what I am looking for! |
| Comment by David Storch [ 09/Feb/18 ] |
|
Hi dexter.esajas, I think this should be treated as a duplicate of SERVER-714. As Andy mentioned above, it would be nice to allow multi-updates and multi-deletes to return a cursor containing the stream of modified documents. Users should be able to supply a projection which would allow you to project out everything other than the _id field, which would satisfy the particulars of your request. Note that the server already supports findAndModify, which allows users to perform a single-update or single-delete and return a copy of the modified document with a projection applied. Extending findAndModify's functionality to work for multi-document writes is what you need. I'm closing this as a duplicate of SERVER-714. Please watch and vote for that ticket, and feel free to reach out with any questions or concerns. Best, |
| Comment by Dexter Esajas [ 09/Feb/18 ] |
|
It seems related in the way that more info could be returned after an operation has been performed I think. |
| Comment by Asya Kamsky [ 08/Feb/18 ] |
|
Something like SERVER-12858 maybe? |
| Comment by Andy Schwerin [ 07/Feb/18 ] |
|
I haven't thought about this a lot, but occasionally it comes up that users would like to get back a cursor that returns the updated or deleted documents modified by their operations. I can't recall if there are open tickets about that, but perhaps david.storch or asya know. |
| Comment by Dexter Esajas [ 06/Feb/18 ] |
|
@Andy Schwerin, What do you guys think about this functionality/feature? |
| Comment by Andy Schwerin [ 05/Feb/18 ] |
|
You'd probably want to return a cursor of some sort, in case enough docs are modified to overflow a bson array. |
| Comment by Dexter Esajas [ 05/Feb/18 ] |
|
Hi @Ramon Fernandez, Thank you for your quick response! I've missed that it may create a quite some overhead if a user does not require the _id's to be returned. |
| Comment by Ramon Fernandez Marina [ 05/Feb/18 ] |
|
Thanks for your report dexter.esajas; I've tweaked the summary to reflect the improvement nature of this request, and I'm sending this to the Query team for consideration. |
| Comment by Dexter Esajas [ 05/Feb/18 ] |
|
So this applies for both updateMany and deleteMany. |