Update mongodb

This commit is contained in:
sunkaixuan
2025-06-27 19:26:00 +08:00
parent 23ae6355d4
commit 32c5e7a37f
3 changed files with 21 additions and 15 deletions

View File

@@ -508,6 +508,20 @@ namespace SqlSugar.MongoDb
else
return field;
}
internal static BsonValue MyCreate(object value, DbColumnInfo col)
{
if (value != null&&IsObjectColumn(col))
{
return MyCreate(ObjectId.Parse(value?.ToString()));
}
return MyCreate(value);
}
private static bool IsObjectColumn(DbColumnInfo col)
{
return col.DbColumnName == "_id" || col.DataType == nameof(ObjectId);
}
//public static object ConvertDataByTypeName(string ctypename,string value)
//{
// var item = new ConditionalModel() {