void ReadDataGetAllDocumentsInCollection()

in firestore/android/FirestoreSnippetsCpp/app/src/main/cpp/snippets.cpp [578:600]


void ReadDataGetAllDocumentsInCollection(firebase::firestore::Firestore* db) {
  using firebase::Future;
  using firebase::firestore::DocumentSnapshot;
  using firebase::firestore::Error;
  using firebase::firestore::QuerySnapshot;

  // In addition, you can retrieve all documents in a collection by omitting the
  // Where() filter entirely:
  // [START get_multiple_all]
  db->Collection("cities").Get().OnCompletion(
      [](const Future<QuerySnapshot>& future) {
        if (future.error() == Error::kErrorOk) {
          for (const DocumentSnapshot& document :
               future.result()->documents()) {
            std::cout << document << std::endl;
          }
        } else {
          std::cout << "Error getting documents: " << future.error_message()
                    << std::endl;
        }
      });
  // [END get_multiple_all]
}