aggregate method
Old version to be used on MongoDb versions prior to 3.6
Implementation
Future<Map<String, dynamic>> aggregate(List pipeline,
{bool allowDiskUse = false, Map<String, Object>? cursor}) {
if (db.masterConnection.serverCapabilities.supportsOpMsg) {
return AggregateOperation(
pipeline,
collection: this,
cursor: cursor,
aggregateOptions: AggregateOptions(allowDiskUse: allowDiskUse),
).execute();
}
var cmd = DbCommand.createAggregateCommand(db, collectionName, pipeline,
allowDiskUse: allowDiskUse, cursor: cursor);
return db.executeDbCommand(cmd);
}