[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) => { } );
a new clientSession parameter could be provided. This would be the clientSession of the process that inserted/updated/deleted the object, not the local listener clientSession.

Is this possible?
TIA
Kevin Fairclough



 Comments   
Comment by Asya Kamsky [ 07/Apr/18 ]

Currently the only solution is maintaining some state in the object itself.

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.

Generated at Thu Feb 08 04:34:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.