Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

FirebaseError: Function Query.startAfter() called with invalid data. Unsupported field value: a custom object #337

Closed
nguyenthihuong0501 opened this issue Sep 9, 2020 · 1 comment

Comments

@nguyenthihuong0501
Copy link

I use paging to looad the data so in the form of scrolling data
�Here is the code

public async readWithPagination(t: { new(): T },lastData: any | null, orderBy: string = 'sort',directionStr: 'desc' | 'asc'='desc') {
let result: any | null = null
let startAfter = lastData
if ( startAfter == null) {
let first = this.firestoreApp.collection(this.dataPath).orderBy(orderBy,directionStr).limit(1);
let snapshot = await first.get();
startAfter = snapshot.docs[snapshot.docs.length - 1];
}
result = await this.firestoreApp.collection(this.dataPath).orderBy(orderBy,directionStr).startAfter(startAfter).limit(1).get();
return this.convertDocumentToModel(result, t);
}

@kevmoo
Copy link
Contributor

kevmoo commented Oct 28, 2020

The code here looks like Javascript. Is this a bug w/ the Dart package or the JS code?

@kevmoo kevmoo closed this as completed Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants