简体   繁体   English

firestore 更新协议有多聪明

[英]How smart is the firestore update protocol

I am implementing an application that updates a document each second.我正在实施一个每秒更新文档的应用程序。

All connected users are listening to this document.所有连接的用户都在收听此文档。

The document that I update is quite big (ca 40k as json) but most of the times I am only updating a single field in that document.我更新的文档很大(json 约 40k),但大多数时候我只更新该文档中的一个字段。

So I wonder if I should break this data out into its own document or if the protocol that firebase/firestore uses is smart?所以我想知道我是否应该将这些数据分解到它自己的文档中,或者 firebase/firestore 使用的协议是否智能? Ie so that it only sends out the modifified data.即它只发送修改后的数据。

The Firestore client sends the data that you pass to the API call. Firestore 客户端将您传递的数据发送到 API 调用。 So if you call documentRef.update() with a single field, it sends just the path to the document and that field.因此,如果您使用单个字段调用documentRef.update() ,它只会发送文档路径和该字段。 If you call documentRef.set() or .update() with more fields, it passes the path and those fields.如果您使用更多字段调用documentRef.set().update() ,它会传递路径和那些字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM