我已阅读下面的所有问题,但在文档中找不到任何内容来描述如何同步集合和接收only更改集合中的文档。我的同步集合中有超过 500 个文档(使用redux-saga-firebase 同步集合 https://redux-saga-firebase.js.org/guides/syncing-data)但通常只有大约 100 个会发生变化。在任何给定时间,改变的更少,但我目前正在得到all 500+即使有一个更改,文档也会返回,这会导致 500 多次读取。不理想,而且会让我付出巨大的代价。
这是我使用 redux-saga-firebase 的代码,但普通的 firebase 代码答案也足够了。如何获得发送的同步响应only集合中已更改的文档?
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),
}
);
}
Firestore 只同步差异吗? https://stackoverflow.com/questions/50089835/does-firestore-sync-only-diff
Realm 与 Firestore 上的大型集合同步 - 架构问题/问题 https://stackoverflow.com/questions/54096606/realm-syncing-with-large-collection-on-firestore-architectural-questions-iss
如何使用缓存避免不必要的 Firestore 读取 https://stackoverflow.com/questions/52700648/how-to-avoid-unnecessary-firestore-reads-with-cache
Firestore 同步到底有什么作用? https://stackoverflow.com/questions/56682203/what-exactly-does-firestore-synchronization-do