public void FuncAggregateMaxMin() { var q1 = Builders <MyModel> .Select(x => AggregateFunc.Max(x.Id)).Where(x => x.DateTime > Func.Now()); Utils.AssertRawQuery(q1, @"SELECT MAX(""id"") FROM model WHERE (datetime) > (NOW())"); var q2 = Builders <MyModel> .Select(x => AggregateFunc.Min(x.Id)).Where(x => x.DateTime > Func.Now()); Utils.AssertRawQuery(q2, @"SELECT MIN(""id"") FROM model WHERE (datetime) > (NOW())"); }
public async Task TestAggregateFunc() { var dr = await CreateDriver(); var d = await dr.From <MyModel>() .Select(x => AggregateFunc.Max(x.Id)) .ToSingleAsync(); Assert.Equal(3, d); }