【发布时间】:2021-04-24 13:00:30
【问题描述】:
我创建了两个数据模型并尝试使用 mongoDb C# 驱动程序对其应用不同的查询。 这是get方法中的查询
var res = _postCollection.Aggregate().Lookup("_commentCollection", "Comments", "_id", "result").ToList();
return OK(res)
但是当我从邮递员那里调用方法时得到以下结果
System.InvalidCastException: Unable to cast object of type 'MongoDB.Bson.BsonObjectId' to type 'MongoDB.Bson.BsonBoolean'.
at get_AsBoolean(Object )
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnWrite(WriteStackFrame& current, Utf8JsonWriter writer)
...............
【问题讨论】:
标签: c# .net mongodb .net-core bson