Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Created March 1, 2020 19:01
Show Gist options
  • Save hiranya911/e807286c72bd4ead289865ec708bcec3 to your computer and use it in GitHub Desktop.
Save hiranya911/e807286c72bd4ead289865ec708bcec3 to your computer and use it in GitHub Desktop.
data class City(
val name: String? = null,
val state: String? = null,
val country: String? = null,
val isCapital: Boolean? = null,
val population: Long? = null,
val regions: List<String>? = null
)
db.collection("cities")
.whereGreaterThan("population", 1000000)
.get()
.addOnSuccessListener { snapshot ->
for (doc in snapshot) {
val city = doc.toObject(City::class.java)
displayCity(city)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment