Querying Firestore documents by nested key-value in an array field using Python
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
此 issue 未指定任何儲存庫檔案或測試。首先結合 Python FieldFilter API,檢視 Firestore 對 array-contains 和巢狀欄位的查詢行為;完成的標準是確定是否支援此述詞,並記錄適當的查詢方式或該限制。
由索引模型根據 Issue 內容生成。
描述
Is your feature request related to a problem? Please describe.
I'm working with Firestore in Python and have a data query challenge I'm hoping to get some advice on.
My documents in Firestore are structured as follows:
{
"key1": "value1",
"key2": {
"subKey1": [
{
"arrayKey1": "arrayValue1",
"arrayKey2": "arrayValue2"
},
{
"arrayKey3": "arrayValue3",
"arrayKey4": "arrayValue4"
}
],
"subKey2": "subValue2"
}
}
My goal is to query documents where the value of arrayKey1 within the subKey1 array matches a specific value (for example, target_arrayValue1), regardless of the arrayKey2 in the same dictionary.
Here's an example of what my query currently looks like:
docs = query.where(
filter=FieldFilter(
"key2.subKey1",
"array_contains",
{
"arrayKey1": "target_arrayValue1",
"arrayKey2": "arrayValue2"
}
)
).stream()
This approach, however, requires a full match of the dictionary, which is not ideal.
Describe the solution you'd like
My “ideal” code would do something like this:
docs = query.where(
filter=FieldFilter(
"key2.subKey1.0.arrayKey1",
"==",
"target_arrayValue1"
)
).stream()
Is there an appropriate way to structure my query to achieve this? Any insights or examples would be greatly appreciated! Thanks in advance.
- 主要語言
- Python
- 星號
- 1.2k
- 分支
- 362
- 平均合併
- 8 小時 7 分鐘
- 30 天內合併 PR
- 3
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
firebase/firebase-admin-python 的其他 Issue
-
api: remoteconfig
難度 2/5 1-3 小時 新手友好度 75/100
firebase/firebase-admin-python#957 · 1 則留言 ·
維護者通常 1 天內回覆
-
api: database type: feature request
難度 2/5 1-3 小時 新手友好度 62/100
firebase/firebase-admin-python#58 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 45/100
firebase/firebase-admin-python#978 · 1 則留言 ·
維護者通常 1 天內回覆
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node)可能重新可做 @lahirumaramba 於 147 天前認領,目前沒有進行中的 PR。 未關閉api: auth
firebase/firebase-admin-python#949 · 2 則留言 · 1 個 reaction · 已指派 1 人 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
firebase/firebase-admin-python#945 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 firebase/firebase-admin-python 的全部 Issue
相似的 Issue
-
customer-reported
難度 2/5 1-3 小時 新手友好度 68/100
Azure/azure-cli#34150 · 1 則留言 ·
維護者通常 1 天內回覆
-
community-request
難度 1/5 1 小時以內 新手友好度 95/100
NVIDIA-NeMo/Curator#2464 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
WeblateOrg/translation-finder#1099 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
trezor/trezor-firmware#7997 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆