Query a subcollection

Demonstrates how to query a subcollection.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

Kotlin

db.collection("cities")
    .document("SF")
    .collection("landmarks")
    .get()
    .addOnSuccessListener { result ->
        for (document in result) {
            Log.d(TAG, "${document.id} => ${document.data}")
        }
    }
    .addOnFailureListener { exception ->
        Log.d(TAG, "Error getting documents: ", exception)
    }

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.