Mys*_*que 5 rest google-cloud-firestore
您好,我是firestore的新手,我正尝试使用rest API从名为“用户”的集合中查询,查找所有具有名为test2的字段的用户
这是我的POST请求:
https://firestore.googleapis.com/v1beta1/projects/ {myprojectid} / databases /(默认)/ documents / Users:runQuery
身体:
{
"structuredQuery": {
"where" : {
"fieldFilter" : {
"field": {"fieldPath": "about"},
"op":"EQUAL",
"value": {"string": "test2"}
}
},
"from": [{"collectionId": "Users"}]
}
}
Run Code Online (Sandbox Code Playgroud)
我得到回应
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"structured_query\" at 'document': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "document",
"description": "Invalid JSON payload received. Unknown name \"structured_query\" at 'document': Cannot find field."
}
]
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我我在做什么错吗?非常感谢。我被卡住了,无法继续。
小智 11
在你的 URL 中去掉用户。
https://firestore.googleapis.com/v1beta1/projects/ {myprojectid}/databases/(default)/documents:runQuery
| 归档时间: |
|
| 查看次数: |
2019 次 |
| 最近记录: |