MongoDB查询转对象是出错Element '_id' does not match any field or property of class
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; }
}
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)