Summary
When monitoring a change stream, an event of dropDatabase is not handled by the serializer and causes an exception if you attempt to access ChangeStreamDocument.OperationType.
System.FormatException: Invalid ChangeStreamOperationType: "dropDatabase".
|
at MongoDB.Driver.ChangeStreamOperationTypeSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
|
at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
|
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)
|
at MongoDB.Bson.Serialization.BsonSerializationInfo.DeserializeValue(BsonValue value)
|
at MongoDB.Bson.Serialization.BsonDocumentBackedClass.GetValue[T](String memberName, T defaultValue)
|
at MongoDB.Driver.ChangeStreamDocument`1.get_OperationType()
|
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
C# driver version is 2.15.0. Server version is 5.0.6 on a MongoDB Atlas shared cluster.
How to Reproduce
Connect to a cluster. Initiate a watch against the IMongoClient object. Drop a database in the cluster.
|