how to take random document from firestore android
var quotes = firestoreInstance.collection("KEY_COLLECTION");
var key = quotes.document().id
Timber.d("key is $key")
quotes.whereGreaterThan(FieldPath.documentId(), key).limit(1).get()
.addOnSuccessListener { snapshot ->
if (snapshot.size() > 0) {
snapshot.forEach { doc ->
Timber.d("${doc.id} => ${doc.data}")
}
} else {
quotes.whereLessThan(FieldPath.documentId(), key).limit(1).get()
.addOnSuccessListener { snapshot ->
snapshot.forEach { doc ->
Timber.d("${doc.id} =>${doc.data}")
}
}
}
}