collectionGroup method

Query<Map<String, Object?>> collectionGroup(
  1. String collectionId
)

Creates a Query that includes all the documents in the database that are in a collection or subcollection with the given collectionId.

Implementation

Query<Map<String, Object?>> collectionGroup(String collectionId) {
  if (collectionId.isEmpty) {
    throw ArgumentError(
      'Function Firestore.collectionGroup() cannot be called with an empty '
      'collectionId.',
    );
  }
  if (collectionId.contains('/')) {
    throw ArgumentError(
      "Invalid collection ID '$collectionId' passed to function "
      "Firestore.collectionGroup(). Collection IDs must not contain '/'.",
    );
  }
  return Query<Map<String, Object?>>(
    core.Query(ResourcePath.empty, collectionGroup: collectionId),
    this,
  );
}