in firestore/app/src/main/java/com/google/example/firestore/kotlin/DocSnippets.kt [742:806]
fun exampleDataCollectionGroup() {
// [START fs_collection_group_query_data_setup]
val citiesRef = db.collection("cities")
val ggbData = mapOf(
"name" to "Golden Gate Bridge",
"type" to "bridge"
)
citiesRef.document("SF").collection("landmarks").add(ggbData)
val lohData = mapOf(
"name" to "Legion of Honor",
"type" to "museum"
)
citiesRef.document("SF").collection("landmarks").add(lohData)
val gpData = mapOf(
"name" to "Griffth Park",
"type" to "park"
)
citiesRef.document("LA").collection("landmarks").add(gpData)
val tgData = mapOf(
"name" to "The Getty",
"type" to "museum"
)
citiesRef.document("LA").collection("landmarks").add(tgData)
val lmData = mapOf(
"name" to "Lincoln Memorial",
"type" to "memorial"
)
citiesRef.document("DC").collection("landmarks").add(lmData)
val nasaData = mapOf(
"name" to "National Air and Space Museum",
"type" to "museum"
)
citiesRef.document("DC").collection("landmarks").add(nasaData)
val upData = mapOf(
"name" to "Ueno Park",
"type" to "park"
)
citiesRef.document("TOK").collection("landmarks").add(upData)
val nmData = mapOf(
"name" to "National Musuem of Nature and Science",
"type" to "museum"
)
citiesRef.document("TOK").collection("landmarks").add(nmData)
val jpData = mapOf(
"name" to "Jingshan Park",
"type" to "park"
)
citiesRef.document("BJ").collection("landmarks").add(jpData)
val baoData = mapOf(
"name" to "Beijing Ancient Observatory",
"type" to "musuem"
)
citiesRef.document("BJ").collection("landmarks").add(baoData)
// [END fs_collection_group_query_data_setup]
}