aggregate method

Future<List<MongoDocument>> aggregate(
  1. List<PipelineStage> pipeline
)

Implementation

Future<List<MongoDocument>> aggregate(List<PipelineStage> pipeline) async {
  List<dynamic> resultJson = await FlutterMongoRealm.aggregate(
    collectionName: this.collectionName,
    databaseName: this.databaseName,
    pipeline: pipeline.map((doc) => jsonEncode(doc.values)).toList(),
  );

  var result = resultJson.map((string) {
    return MongoDocument.parse(string);
  }).toList();

  return result;
}