MongoDB更新数组时报错 返回

SqlSugar 处理完成
4 350
该叫什么 Gris 发布于2025/8/20
悬赏:0 飞吻

执行:

await _client.Updateable<Foo>().SetColumns(x=>x.Contents == entity.Contents).Where(x=>x.Id == entity.Id).ExecuteCommandAsync();


在 Foo 的定义中, 对Contents 加了注解: 

/// <summary>
/// 操作内容
/// </summary>
[SugarColumn(IsJson = true)]
public List<OperateTypeDto> Contents { get; set; }


运行后报错: 

.NET type Library.PublicModels.SqlSugarEntities.OperateTypeDto cannot be mapped to a BsonValue.


请问是哪里用的不对吗? 

热忱回答4

  • fate sta fate sta VIP0
    2025/8/20

    我看一下

    0 回复
  • fate sta fate sta VIP0
    2025/8/20

    SqlSugar.MongoDbCore 5.1.4.251

    过五分钟更新到这个版本。 已修复

    0 回复
  • Gris Gris VIP0
    2025/8/20

    @fate sta:感谢大佬

    0 回复
  • Gris Gris VIP0
    2025/8/20

    @fate sta:已测试通过, 问题已解决

    0 回复