modernAggregateCursor method

ModernCursor modernAggregateCursor(
  1. dynamic 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,
})

This method returns a curosr that can be read or transformed into a stream with stream (for a stream you can directly call modernAggregate)

It corresponds to the legacy method aggregate()

The pipeline can be either an AggregationPipelineBuilder or a List of Maps (List<Map<String, Object>>)

Implementation

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