簡體   English   中英

如何從Firebase實時數據庫中選擇數據

[英]How to select data from firebase realtime database

我有一個具有結構的數據庫,大致像

// An index to track Ada's memberships
{
  "users": {
    "alovelace": {
      "name": "Ada Lovelace",
      // Index Ada's groups in her profile
      "groups": {
         // the value here doesn't matter, just that the key exists
         "techpioneers": true,
         "womentechmakers": true
      }
    },
    ...
  },
  "groups": {
    "techpioneers": {
      "name": "Historical Tech Pioneers",
      "members": {
        "alovelace": true,
        "ghopper": true,
        "eclarke": true
      }
    },
    ...
  }
}

但我不知道如何選擇屬於同一組用戶的用戶

您必須定義一個附加的group_combinationsall_groups索引,在其中將每個用戶存儲在他們的組合下:

all_groups: {
  "techpioneers_womentechmakers": {
    alovelace: true
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM