/// <summary>
/// Runs an aggregation over the mongodb
/// </summary>
/// <param name="args">the aggregation pipeline</param>
/// <returns>the aggregate data</returns>
public IEnumerable<BsonDocument> Aggregate(IEnumerable<BsonDocument> pipeline)
{
// Get our mongo db objects
var rmu = DB()
.GetServer()
.GetDatabase(Database)
.GetCollection(Collection); // Execute
var cmd = new AggregateArgs() { Pipeline = pipeline, OutputMode = AggregateOutputMode.Cursor, AllowDiskUse = true };
var results = rmu.Aggregate(cmd);
return results;
}}
var cursor = await col.AggregateAsync<BsonDocument>(pipeline.ToList(), options);