Hello everyone,
I’m encountering a RuntimeError
while trying to perform a query on Google Cloud Firestore. The error message I’m receiving is as follows:
1RuntimeError
2[400] Invalid JSON payload received. Unknown name "structuredQuery" at 'document': Cannot find field.
Context:
I’m trying to query the Users
collection to find a document where the email
field equals hello@mail.com
. Here’s the structure of the query I’m attempting to send:
JSON
Collapse
1{
2 "structuredQuery": {
3 "from": [
4 {
5 "collectionId": "Users",
6 "allDescendants": false
7 }
8 ],
9 "where": {
10 "fieldFilter": {
11 "field": {
12 "fieldPath": "email"
13 },
14 "op": "EQUAL",
15 "value": {
16 "stringValue": "hello@mail.com"
17 }
18 }
19 },
20 "limit": 1
21 }
22}
[
{
"from": {},
"path": "/Users",
"limit": 100,
"select": {},
"filters": [
[
{
"a": "email",
"b": "hello@mail.com",
"o": "fieldFilter::EQUAL::stringValue"
}
]
],
"input_type": "select",
"project_id": "xxx",
"query_type": "builder"
}
]
Questions:
- Has anyone encountered a similar issue?
- What could be causing the “Unknown name ‘structuredQuery’” error?
- Are there any best practices for constructing Firestore queries in JSON format?
Any help or insights would be greatly appreciated!
Thank you!