MongoDB查询转对象是出错Element '_id' does not match any field or property of class
解决方法:
1、在实体类加:[BsonIgnoreExtraElements]
2、或者定义public ObjectId _id { get; set; }
例子:
[BsonIgnoreExtraElements]
public class BaseData
{
//public ObjectId _id { get; set; }
public string cNo { get; set; }
public string customer { get; set; }
public long batchNo { get; set; }
public DateTime mDate { get; set; }
public string mUser { get; set; }
}
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/p/6230202.html,如需转载请自行联系原作者