让我说我上课
class Person
{
[BsonElement("name")]
public string Name { get; set; }
[BsonElement("age")]
public int? Age { get; set; }
}
然后在mongo中有
[{ “ name”:“ Jan”, “年龄”:null },{ “ name”:“ San”, “年龄”:20 },{ “年龄”:20 }]
然后打电话
collection.Find(filter).Project<Person>(projections).ToListAsync()
然后我回来
[{ “名称”:“ Jan”, “年龄”:空 },{ “名称”:“ San”, “年龄”:20 },{ “名称”:null, “年龄”:20 }]
有没有办法查看该字段是否丢失,而不仅仅是返回空值