I've read all of the questions below, and cannot find anything in the docs to describe how to sync a collection and receive only changed documents from a collection. I've got over 500 documents in my synced collection (using redux-saga-firebase syncCollection) but usually only about 100 of them ever change. At any given time, even fewer will change, but I'm currently getting all 500+ documents back when even one changes, which results in 500+ reads. Not ideal, and will cost me at scale.
Here is my code using redux-saga-firebase, but a vanilla firebase code answer would also suffice. How can get a synchronized response that sends only the changed documents in the collection?
export function* getPlayersFromDb() {
yield fork(
rsf.firestore.syncCollection,
'players',
{ successActionCreator: response => ({
type: t.GET_PLAYERS_FROM_DB_SUCCESS,
payload: [...response],
}),
failureActionCreator: () => ({
type: t.GET_PLAYERS_FROM_DB_FAILURE,
payload: [],
}),
transform: response => messageTransformer(response),
}
);
}
Does Firestore sync only diff?
Realm syncing with large collection on Firestore - architectural questions / issues