Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

.NET change streams

Hi, is it possible to get the identifier of the user who changed the record using Change streams? How to get userid from a given string BackingDocument = {{ “txnNumber” : NumberLong(1), “lsid” : { “id” : CSUUID(“69de8063-6056-436a-a34f-4477535e79aa”), “uid” : new BinData(0, “KJ597HGXhcWn9yDeXiCOgCLrzOMR7Hpfnh3wu16W8DE=”) }, “_id” : { “_data” : "825EF58337000000012B022C0100296E5A10041FCA10F429D1401496F906B747…

Hi @Valeriy_Filippenkov, and welcome to the forum!

Depending on your use case, you can include the user who performs the update as part of the document update operation. This should be reflected in the update delta of the change events. See also Lookup Full Document for Update Operations.

If the database deployment is on Atlas, depending on the use case, you could set up Auditing. See also Set up Database Auditing.

Regards,
Wan

thank you but I need to get a user UUID from this line «uid»: новый BinData (0, «KJ597HGXhcWn9yDeXiCOgCLrzOMR7Hpfnh3wu16W8DE =»)}

Hi @Valeriy_Filippenkov,

I don’t think the question is about MongoDB Change Streams, this is about how to deserialise a binary data in .NET/C#.

How did you insert or generate this binary data ? Could you please elaborate more on the environment ? Generally a UUID object will show up as CSUUID. Depending on what the object instance of the binary data is for uid field, you need to find out how to deserialise it.

Regards,
Wan.