简体   繁体   English

"Firestore - 如何以最有效的方式构建数据?"

[英]Firestore - How to structure data the most efficient way?

I am a self-taught developer and currently I am working on a finance app and would like to ask you which way is more efficient to store my data in Firestore.我是一名自学成才的开发人员,目前我正在开发一个金融应用程序,想问你哪种方式更有效地将我的数据存储在 Firestore 中。

To say it in general, I have many users, but which also have many transactions and query them with a stream in real time.总的来说,我有很多用户,但也有很多事务,并通过流实时查询它们。 My question now is how it would be better to store this data and whether there are also advantages in terms of cost?我现在的问题是如何更好地存储这些数据以及在成本方面是否也有优势?

My structures to store this data would be like followed:我存储这些数据的结构如下:

在此处输入图像描述<\/a>

Which structure would you use, or is there even a better way to structure this data?您将使用哪种结构,或者是否有更好的方法来构建这些数据?

Thanks in advance for your answers😄提前感谢您的回答😄

"

因为您正在使用 Firestore,所以我认为您想要优化读取\/写入,所以我更喜欢第一个,因为您将拥有用户自己的事务,但另一个您将为用户读取,另一个为其读取自己的交易,但您可以通过两者来做得更好,因为您可能只需要获取交易,这样您就可以从交易集合中获取它,避免额外的查询从用户集合中获取每笔交易

"

for simplicity, and what i usually do is the "STRUCTURE 2".为简单起见,我通常做的是“结构2”。 the structure 2 is what i usually use结构2是我通常使用的

"

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

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