[SERVER-41559] Can not fetch changed array elements from change streams Created: 06/Jun/19 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Change streams |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Han | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | change-streams-improvements, pm1950-m6 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||
| Description |
|
Here are outputs for corresponding steps, What I need is to manipulate the deleted array item, but it seems not workable. 1) First , here is the initial data in the database, there're 3 outer array items "test-0, test-1, test-2" with each has 3 inner array items "nest-test-0,nest-test-1,nest-test-3":
2) Next , I pull one nested array item by calling 'collection.updateOne(...)' where 'Update' and 'UpdateOptions' like:
It's clear above that I specify the '$[item0]' with 'Filter{fieldName='item0.name', value=test-0}' to delete the inner array item 'nest-test-2' from outer array item 'test-0'. 3) After step 2), finally I recieve the change event:
From the output we can see that it's an 'update' operation type and the 'updatedFields' is :
Note 'updatedFields' above just provides data after '$pull', but I really need to see detail deleted data information "what I delete from where", an idealy output I would prefer is like kind of :
In this way , with 'array-filter' and 'pulled' fields, I could get the deleted data and notify listeners just like 'DataTreeChangeService' does:
|
| Comments |
| Comment by Eric Sedor [ 10/Jun/19 ] | |||
|
Thanks for the additional information, jiehan2019; I'm passing this on to an appropriate team for consideration. Please watch this ticket for updates. | |||
| Comment by Han [ 10/Jun/19 ] | |||
|
Hi @Eric, As a result, for example above,
2. result of 'getDataBefore':
3. result of 'getDataAfter':
| |||
| Comment by Eric Sedor [ 06/Jun/19 ] | |||
|
Hi jiehan2019; Some of what you are asking for would be provided with Would the full contents of the original array satisfy your requirements? |