in firestore/android/FirestoreSnippetsCpp/app/src/main/cpp/snippets.cpp [818:842]
void ReadDataExecuteQuery(firebase::firestore::Firestore* db) {
using firebase::Future;
using firebase::firestore::DocumentSnapshot;
using firebase::firestore::Error;
using firebase::firestore::FieldValue;
using firebase::firestore::QuerySnapshot;
// After creating a query object, use the Get() function to retrieve the
// results:
// This snippet is identical to get_multiple above.
db->Collection("cities")
.WhereEqualTo("capital", FieldValue::Boolean(true))
.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;
}
});
}