Raj*_*jju 5 rest json firebase google-cloud-firestore
我正在努力使用Firestore REST API.数据库有一个用户集合.每个用户都是单独的文件.我需要让所有用户,例如,类别等于1.这是我的尝试(请求正文):
{
"structuredQuery": {
"where" : {
"fieldFilter" : {
"field": { "fieldPath" : "category" } ,
"op":"EQUAL",
"value": { "integerValue" : 1 }
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
和响应错误:
"error": {
"code": 400,
"message": "kind is required for filter: category",
"status": "INVALID_ARGUMENT"
}
Run Code Online (Sandbox Code Playgroud)
我完全不知道,"fieldFilter"中的"field"应该是什么样子.提前致谢.
Vea*_*tch 12
我相信如果你包含结构化查询的"from"属性,这将有效.如果你要查询的集合被称为"用户",它将看起来像这样,基于你在上面发布的内容:
{
"structuredQuery": {
"where" : {
"fieldFilter" : {
"field": {"fieldPath": "category"},
"op":"EQUAL",
"value": {"integerValue": 1}
}
},
"from": [{"collectionId": "users"}]
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2243 次 |
| 最近记录: |