in firestore/android/FirestoreSnippetsCpp/app/src/main/cpp/snippets.cpp [484:508]
void ReadDataGetDocument(firebase::firestore::Firestore* db) {
using firebase::Future;
using firebase::firestore::DocumentReference;
using firebase::firestore::DocumentSnapshot;
using firebase::firestore::Error;
using firebase::firestore::FieldValue;
// The following example shows how to retrieve the contents of a single
// document using Get():
// [START get_document]
DocumentReference doc_ref = db->Collection("cities").Document("SF");
doc_ref.Get().OnCompletion([](const Future<DocumentSnapshot>& future) {
if (future.error() == Error::kErrorOk) {
const DocumentSnapshot& document = *future.result();
if (document.exists()) {
std::cout << "DocumentSnapshot id: " << document.id() << std::endl;
} else {
std::cout << "no such document" << std::endl;
}
} else {
std::cout << "Get failed with: " << future.error_message() << std::endl;
}
});
// [END get_document]
}