小编Mys*_*que的帖子

firebase-Firestore REST API开始查询

您好,我是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)

rest google-cloud-firestore

5
推荐指数
1
解决办法
2019
查看次数

标签 统计

google-cloud-firestore ×1

rest ×1