Skip to content

Commit

Permalink
Fix Min(Func<T,TResult>) handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gcrossland-cosworth committed Feb 16, 2023
1 parent cd1ae01 commit 109cca0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions LiteDB.Tests/Mapper/LinqBsonExpression_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ public void Linq_Enumerables()

// aggregate with map
TestExpr<User>(x => x.Phones.Sum(w => w.Number), "SUM(MAP($.Phones => @.Number))");
TestExpr<User>(x => x.Phones.Average(w => w.Number), "AVG(MAP($.Phones => @.Number))");
TestExpr<User>(x => x.Phones.Max(w => w.Number), "MAX(MAP($.Phones => @.Number))");
TestExpr<User>(x => x.Phones.Min(w => w.Number), "MIN(MAP($.Phones => @.Number))");

// map
TestExpr<User>(x => x.Phones.Select(y => y.Type), "MAP($.Phones => @.Type)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public virtual string ResolveMethod(MethodInfo method)
case "Sum(Func<T,TResult>)": return "SUM(MAP(@0 => @1))";
case "Average(Func<T,TResult>)": return "AVG(MAP(@0 => @1))";
case "Max(Func<T,TResult>)": return "MAX(MAP(@0 => @1))";
case "Min(Func<T,TResult>)": return "MAP(MIN(@0 => @1))";
case "Min(Func<T,TResult>)": return "MIN(MAP(@0 => @1))";

// convert to array
case "ToList()":
Expand Down

0 comments on commit 109cca0

Please sign in to comment.