[SERVER-26612] Add reporting of the number of documents found to the Bulk find() operations Created: 12/Oct/16 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | William Byrne III | Assignee: | Backlog - Server Tooling and Methods (STM) (Inactive) |
| Resolution: | Unresolved | Votes: | 6 |
| Labels: | move-stm | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Assigned Teams: |
Server Tooling & Methods
|
| Participants: |
| Description |
|
Currently bulk operations like this:
report nothing in the {{BulkWriteResult object }} object for documents in the newDocArray whose _id values don't match any documents in the collName collection. This feature request is to add reporting on the number of documents found by each operation. |
| Comments |
| Comment by Steven Vannelli [ 10/May/22 ] |
|
Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions. |
| Comment by William Byrne III [ 13/Oct/16 ] |
|
See the attachment fr2.js for sample code that exhibits the issue. The oldData collection has _id's 0,1,2. The newData array has _ids 1,2,3. The bulk update to replace documents in the collection with documents from the array returns "nMatched" : 2 and "nModified" : 2. This is because the unmatched documents aren't an error, but it means you have to rerun the find part of each operation to identify those that found 0 documents. In more detail, what is being requested is:
The `foundDocs` field will be populated by `Bulk` operations that include a `find()`:
If `foundDocs.nFound` = 0, the replacement document did not get written to the collection. If `foundDocs.nFound` > `foundDocs.nModified` then the desired document might not have been replaced. |