[SERVER-33745] ChangeStream clientSession passed to change event Created: 08/Mar/18 Updated: 07/Apr/18 Resolved: 07/Apr/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Kevin Fairclough | Assignee: | Asya Kamsky |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
We have many (>1) applications making changing to the same collections it would be nice to determine which client/application instigated the change in the database. Currently the only solution is maintaining some state in the object itself. Ideally when we listen to stream.on('change', (change, clientSession) => { } ); Is this possible? |
| Comments |
| Comment by Asya Kamsky [ 07/Apr/18 ] |
This is the only correct solution. Change streams is a server-side feature, and in order for it to provide such information, the server would have to save in the oplog information about client session which made the write operation. This does not seem like correct approach so our recommendation is to have client write the necessary information into the object itself if this information is needed downstream. |