Skip to content

Commit

Permalink
Merge pull request #2287 from gcrossland-cosworth/min_handling_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mbdavid committed Mar 9, 2023
2 parents 8fc6b7e + 109cca0 commit 7e70c20
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 7e70c20

Please sign in to comment.