aggregate method

Stream<Map<String, dynamic>> aggregate(
  1. List<Map<String, Object>> pipeline, {
  2. bool? explain,
  3. Map<String, Object>? cursor,
  4. String? hint,
  5. Map<String, Object>? hintDocument,
  6. AggregateOptions? aggregateOptions,
  7. Map<String, Object>? rawOptions,
})

Runs a specified admin/diagnostic pipeline which does not require an underlying collection. For aggregations on collection data, see dbcollection.modernAggregate().

Implementation

Stream<Map<String, dynamic>> aggregate(List<Map<String, Object>> pipeline,
    {bool? explain,
    Map<String, Object>? cursor,
    String? hint,
    Map<String, Object>? hintDocument,
    AggregateOptions? aggregateOptions,
    Map<String, Object>? rawOptions}) {
  if (!masterConnection.serverCapabilities.supportsOpMsg) {
    throw MongoDartError('At least MongoDb version 3.6 is required '
        'to run the aggregate operation');
  }
  return ModernCursor(AggregateOperation(pipeline,
          db: this,
          explain: explain,
          cursor: cursor,
          hint: hint,
          hintDocument: hintDocument,
          aggregateOptions: aggregateOptions,
          rawOptions: rawOptions))
      .stream;
}