I want to iterate a collection which starts at collection document ID.
Is there any method like below which let us read data start at an id or an attribute id?
db.collection("questions").startReadingDocumentAt("02cubnmO1wqyz6yKg571 ").limit(10).get()
or
db.collection("questions").startReadingWhereEqualTo("questionID","02cubnmO1wqyz6yKg571 ").limit(10).get()
I know I can read that DocumentSnapShot on basis of Id and can then start iterating with lastVisible item. but it cost me two read operation. Can it be done in one.
Firestore-root
|
--- questions (collections)
| |
| --- 02cubnmO1wqyz6yKg571 (questionId document) // myID and my questionID is same
| |
| --- questionId: "02cubnmO1wqyz6yKg571"
| |
| --- title: "Question Title"
| |
| --- date: August 27, 2018 at 6:16:58 PM UTC+3
| |
I already have gone through this
Explanation
I don't want to do RecyclerView pagination
. I want to load next 10 question each time an Activity starts. So I call the query in the same manner but it requires me to save the DocumentSnapShot. So I decided to save the questionID and read data on basis of it...