Closed thuan1412 closed 2 months ago
` const collectionQuery = filterSafe.collectionQuery; delete filterSafe.collectionQuery;
const r = await this.tryGetResource(
resourceName,
"REFRESH",
collectionQuery
);
const data = r.list;
if (params.sort != null) {
const { field, order } = params.sort;
if (order === "ASC") {
sortArray(data, field, "asc");
} else {
sortArray(data, field, "desc");
}
}
let softDeleted = data;
if (this.options.softDelete && !Object.keys(filterSafe).includes('deleted')) {
softDeleted = data.filter(doc => !doc['deleted'])
}
const filteredData = filterArray(softDeleted, filterSafe);`
This code from file FirebaseClient.ts . Will this code will get all data from the firebase collection then sort and filter it? If right, why don't you use firebase sort, filter API for this? I think this is the reason make the program slow when working with large firebase collection?
Any updates about this ? Experiencing the same problem here
@simokhalil You have to create a new FirebaseProvider that use Firebase to sort, find, v.v document.
Found this interesting PR #125 that implements a data provider using the Firebase SDK instead of downloading all data, and it's working great so far, except the pagination but that's not a problem for me
Does the library implement backend pagination ? because I understand that it's not possible to get a collection count in Firestore without performing a read on all documents.
My collection( namely
Player
) has roughly 17000 document. When i open the list of players( get 10 players from 17000), it take me about 15s to load the page. I have tried fetch the same data using firebase-admin and it take less than 1s to get 10 players. So my question is how can i improve this slow loading.