Firebase 使用REST API对Firestore查询进行结构化查询的多个where条件

Firebase 使用REST API对Firestore查询进行结构化查询的多个where条件,firebase,google-cloud-firestore,Firebase,Google Cloud Firestore,上面是我现在的示例结构化查询, 在这里,我需要添加“category”作为新条件(比如name) 请任何人在这方面帮助我。您可以使用,因为他们提供了查询多个字段的选项。请记住,如果您对查询进行排序,它将位于过滤器的第一个字段 export const structuredQuery = { "from": [{ "collectionId": "products", "allDescen

上面是我现在的示例结构化查询, 在这里,我需要添加“category”作为新条件(比如name)

请任何人在这方面帮助我。

您可以使用,因为他们提供了查询多个字段的选项。请记住,如果您对查询进行排序,它将位于过滤器的第一个字段

export const structuredQuery = {
    "from": [{
        "collectionId": "products",
        "allDescendants": false
    }],

    "where": {
        "fieldFilter": {
            "field": {
                "fieldPath": "name"
            },
            "op": "EQUAL",
            "value": {
                "stringValue": "test"
            }
        }
    }
};
export const structuredQuery = {
    "from": [{
        "collectionId": "products",
        "allDescendants": false
    }],

    "where": {
        "compositeFilter": {
            "op": "AND",
            "filters": [{
                "fieldFilter": {
                    "field": {
                        "fieldPath": "name"
                    },
                    "op": "EQUAL",
                    "value": {
                        "stringValue": "test"
                    }
                }
            }]
        }

    }
};