Update mongodb

This commit is contained in:
sunkaixuan
2025-07-04 19:37:43 +08:00
parent f732cc36ae
commit c10950e7b6
4 changed files with 26 additions and 1 deletions

View File

@@ -60,6 +60,10 @@ namespace SqlSugar.MongoDb
{
projectionDocument[fieldName] = json;
}
else if (memberAssignment.Expression is MethodCallExpression callExpression&&callExpression.Method.Name==nameof(SqlFunc.IIF))
{
projectionDocument[fieldName] = json;
}
else
{
projectionDocument[fieldName] = "$" + json.ToString();

View File

@@ -45,7 +45,7 @@ namespace SqlSugar.MongoDb
var funcString = context.ToString(model);
result = BsonDocument.Parse(funcString);
}
else if (name.StartsWith("To"))
else if (name.StartsWith("To")||name==nameof(SqlFunc.IIF))
{
var value = context.GetType().GetMethod(name).Invoke(context, new object[] { model });
result = BsonDocument.Parse(value?.ToString());