AggregateOperation constructor
AggregateOperation(})
Implementation
AggregateOperation(Object pipeline,
{DbCollection? collection,
Db? db,
bool? explain,
Map<String, Object>? cursor,
this.hint,
this.hintDocument,
AggregateOptions? aggregateOptions,
Map<String, Object>? rawOptions})
: cursor = cursor ?? <String, Object>{},
explain = explain ?? false,
super(
collection?.db ?? db,
<String, Object>{
...?aggregateOptions?.getOptions(collection?.db ?? db),
...?rawOptions
},
collection: collection,
aspect: Aspect.readOperation) {
if (pipeline is List<Map<String, Object>>) {
this.pipeline = <Map<String, Object>>[...pipeline];
} else if (pipeline is AggregationPipelineBuilder) {
this.pipeline = pipeline.build();
} else {
throw MongoDartError('Received pipeline is "${pipeline.runtimeType}", '
'while the method only accept "AggregationPipelineBuilder" or '
'"List<Map<String, Object>>" objects');
}
}