collectionGroup method

Pipeline collectionGroup(
  1. String collectionId, {
  2. String? forceIndex,
  3. Map<String, Object?>? rawOptions,
})

Reads the documents of every collection with the id collectionId, wherever it is in the database.

Implementation

Pipeline collectionGroup(
  String collectionId, {
  String? forceIndex,
  Map<String, Object?>? rawOptions,
}) {
  if (collectionId.isEmpty || collectionId.contains('/')) {
    throw ArgumentError(
      "Invalid collection id '$collectionId'. A collection id must not be "
      "empty and must not contain '/'.",
    );
  }
  return _start(
    Stage(
      'collection_group',
      args: <pb.Value Function(PipelineEncoder)>[
        (_) => pb.Value()..referenceValue = '',
        (_) => stringValue(collectionId),
      ],
      options: _forceIndex(forceIndex),
      rawOptions: rawOptions,
    ),
  );
}