-
Type: Task
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Change Streams
-
None
-
(copied to CRM)
Account/Company Name: Synergy Sports Technology LLC
Issue + Relevant Info
Customer is getting the following error message in their C# code after upgrading to version 7.0. They are running changeStream and their code requires pre- and post-images (have [changeStreamPreAndPostImages.enabled: true] set)
System.InvalidCastException: Unable to cast object of type 'MongoDB.Bson.BsonNull' to type 'MongoDB.Bson.BsonDocument'. at MongoDB.Bson.BsonValue.get_AsBsonDocument() at MongoDB.Driver.ChangeStreamDocument`1.get_FullDocumentBeforeChange()
They are running C# version 2.20.0 and is compatible with 7.0
https://www.mongodb.com/docs/drivers/csharp/current/compatibility/#std-label-csharp-compatibility-tables
Found this Jira that might be related - CSHARP-4745
Portion of customer's code snippets they use for changeStreams:
await database.WatchAsync(pipeline, new ChangeStreamOptions { ResumeAfter = token.Token, FullDocument = ChangeStreamFullDocumentOption.WhenAvailable, FullDocumentBeforeChange = ChangeStreamFullDocumentBeforeChangeOption.WhenAvailable }, cancellationToken);
this gets full document from ChangeStreamDocument<BsonDocument> change like this:
var fullDocument = change.FullDocument != default ? change.FullDocument : change.FullDocumentBeforeChange; - this line throws an exception
Requested Action
- Investigate and advise what may be the cause and workaround
- Verify if this is may be related to
CSHARP-4745
Status
Customer Name | Synergy Sports Technology LLC |
Is the customer production-down NOW? | *NO* |
Intercom/Case Link and Severity | NA |
Link to Cluster | Org/Project/Cluster Link - (M20 Instance) |
Affected Nodes & Status | |
Have I attempted to restart the affected nodes? | *NO* |