[SERVER-2106] findAndModify a batch WAS: It would be nice to return Documents that were updated as part of a Update or Upsert query. Created: 16/Nov/10 Updated: 10/Sep/14 Resolved: 27/Oct/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Usability |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Andre' Hazelwood | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
In order to easily represent a queue, it would be nice to be able to do the following: Update the top 10 records with some value and then return those records as part of the same query. Currently, we can utilize FindAndModify to return a single record, but it would be nice to be able to do this in batches: jobs = db.jobs.findAndModify( {sort: {priority:-1}, {locked: 1}, count: 10} ); |
| Comments |
| Comment by Andre' Hazelwood [ 16/Dec/11 ] |
|
Lucas, So for example, if I issue a query to find and update the first X records and set some values, I would like to be able to get back the Ids of the actual Documents updated without having to query from some identifier that I just set. For example: Update a maximum of 10 records based on the time property descending, and then return the DocumentIds/other properties as part of the response. The only addition to issue 714, would be the optional ability to return a set of user-defined Properties as part of the response. Let me know if you think it is still the same as 714. Thanks, |
| Comment by Eliot Horowitz (Inactive) [ 27/Oct/11 ] |
|
Yes - thanks for the catch SERVER-714 |
| Comment by Lucas Zamboulis [ 26/Oct/11 ] |
|
Isn't this a duplicate of https://jira.mongodb.org/browse/SERVER-714 ? |