I am struggling with Firestore REST API. Database have a collection with Users. Every user is separate document. I need to get all users with, for example, category equal 1. Here is my attempt (request body):
{
"structuredQuery": {
"where" : {
"fieldFilter" : {
"field": { "fieldPath" : "category" } ,
"op":"EQUAL",
"value": { "integerValue" : 1 }
}
}
}
}
and response error:
"error": {
"code": 400,
"message": "kind is required for filter: category",
"status": "INVALID_ARGUMENT"
}
I have totaly no idea, how "field" inside "fieldFilter" should looks like. Thanks in advance.
I believe if you include the "from" property of the structured query, this will work. If the collection you're querying from is called "users" it would look like this, based on what you posted above:
{
"structuredQuery": {
"where" : {
"fieldFilter" : {
"field": {"fieldPath": "category"},
"op":"EQUAL",
"value": {"integerValue": 1}
}
},
"from": [{"collectionId": "users"}]
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With