【问题标题】:FireStore Data Structuring Advice Please请提供 FireStore 数据结构建议
【发布时间】:2018-04-13 11:49:58
【问题描述】:

请给我一些关于在 FireStore 中构建数据的建议,我们将有大约 10,000 个使用应用程序进行保险的用户,记录所涵盖的产品/工具并添加照片。

我见过Hierarchic structure Firestore and subcollections,这有帮助,但不是我想问的。

选项 1:单个查询/订阅 选项 2:更多查询/订阅,但整体数据交换更少,因为可以针对各个部分提出请求

选项 1....

ClientID
  ClientData
    Name
    Address
  Product
    ProductID
    PolicyNumber
    StartDate
    ExpriyDate
  Tools
    ProductID
    PolicyNumber
    StartDate
    ExpriyDate
    Photos
      0
      1
      2
  Claims
    ClaimID
    PolicyNumber
    Date
    Photos

选项 2....

ClientData
  Name
  Address
Product
  ClientID
    ProductID
    PolicyNumber
    StartDate
    ExpriyDate
Tools
  ClientID
    ProductID
    PolicyNumber
    StartDate
    ExpriyDate
    Photos
      0
      1
      2
Claims
  ClientID
    ClaimID
    PolicyNumber
    Date
    Photos

【问题讨论】:

  • 你在Firestore and NoSQL看过这个视频吗?
  • 结构通常由查询模式决定。你能解释更多你期望的用例吗?如果客户需要所有(或大部分数据),那么选项 1 可能更有意义。如果您担心他们无法访问他们不需要的数据,选项 2 可能会更好。由于 Firestore 保持开放连接,因此很难知道多个请求与一个大型请求的影响。通常请求开销远高于一点额外数据

标签: firebase google-cloud-firestore


【解决方案1】:

是的,你是对的,通过查询,99% 的时间都是“where client ID =”所以我猜是选项 1,所以我可以这样做

firebase.database().ref('db/' + this.user.uid'...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    • 2019-03-25
    • 1970-01-01
    • 2016-05-21
    • 1970-01-01
    • 2019-02-25
    • 2011-12-24
    相关资源
    最近更新 更多