ChangeStreamDocument.ClusterTime总是抛出FormatException

时间:2018-09-06 12:30:07

标签: c# .net mongodb

我在Windows 7上使用proc sql noprint; create table newtable as select var2 from mytable where var1<value; quit; dll中的MongoDB.Driver 2.7.0,而不是配置了单个副本集的本地安装社区服务器4.0.2。

我正在侦听集合上的更改流,但是当我仅尝试访问生成的net461/netstandard2.0的{​​{1}}属性时,它将引发异常:

ClusterTime

看看支持文档,ChangeStreamDocument确实是 private static DateTime? GetTimeStamp(ChangeStreamDocument<T> csd) { try { var clusterTime = csd.ClusterTime; // BOOM return clusterTime.ToNullableUniversalTime(); } catch { return null; } } System.FormatException HResult=0x80131537 Message=Cannot deserialize a 'BsonDocument' from BsonType 'Timestamp'. Source=MongoDB.Bson StackTrace: at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.EnsureBsonTypeEquals(IBsonReader reader, BsonType bsonType) at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.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 Foo.GetTimeStamp(ChangeStreamDocument`1 csd) in Foo.cs:line 28

clusterTime

这是错误/已知问题还是我的设置有问题?

1 个答案:

答案 0 :(得分:0)

MongoDB已确认这是一个错误。