Aggregate

Execute MongoDb aggregate over your database

When you have a complex query where you need to link more than several collections together, and when you need to calculate, aggregate, sum up, and group the data, you can write aggregate and execute it from the API.

var client = new CodeMashClient(apiKey, projectId);
var service = new CodeMashRepository<Person>(client);

var aggregateOptions = new AggregateOptions {
    Tokens = new Dictionary<string, string> { { "name", "John" } }
}

var aggregateResult = await service.AggregateAsync<PersonProjection>(
    Guid.Parse("{AGGREGATE_ID}"),
    aggregateOptions
);

Check the docs on aggregation.

Last updated