Reputation: 6281
I'm trying to use a cursor, however whenever I query this I don't get any results. For example, the below returns 0, null
const next = admin.firestore().collectionGroup('extItems')
.where('platform', "==", "mba")
.orderBy('created_at')
.startAt('7F6JDHOd6c9cXZqclaVf')
.limit(100);
const result = await next.get();
console.log(result.docs.length)
if(result.docs.length <= 0) console.log("null")
I've ran this query without the startAt and its fine. It also doesn't seem to matter which documentId I use as a cursor either.
Not entirely sure what I'm doing wrong here?
Upvotes: 2
Views: 452
Reputation: 139019
There is no way you can pass a document id 7F6JDHOd6c9cXZqclaVf
to the startAt()
function and expect to return all the documents that are after that id. In Cloud Firestore you cannot do that because the documents are not in an order so you can know from where to start. If you want to use that function, you shold pass the value of a property that exsits within your document.
Upvotes: 2