我对 firecloud 中的查询有疑问。
例如,请参阅我的文档:
我需要过滤 account_id 为“value”且“approve”为 true 的所有文档。我怎么做?
我试过: where("members.account_id", "==, "qgZ564nfEaNP3Nt4cW1K3jCeVlY2") 不工作:
看,这是一个不是针对特定语言的问题,只是关于 firestore 查询,在 undestand 之后,我将它应用到我的代码中。
我正在用颤振编程。
firebase google-cloud-platform flutter google-cloud-firestore
我正在使用一个使用以下层次结构的Firestore数据库的应用程序:parent_collection:parent_document:子集合:child_document {字符串名称}使用collectionGroup我已经能够查询子集合中具有特定名称的文档,但是我没有知道如何获取parent_document
db.collectionGroup("subcollection").whereEqualTo("name", searchText).get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if(task.isSuccessful()){
//here I want to get the parent id of all results
}
}
});
Run Code Online (Sandbox Code Playgroud)
做到这一点的最佳方法是什么?
我对 firebase 真的很陌生,老实说,我发现查询很难写。我正在使用 python 编写一个脚本,firebase_admin我希望查询/答案在 python 代码中,但在任何其他编程语言中都可以。
这是我的一份文件,一份文件包含photos集
photos: {
id1: true
id2: true
}
Run Code Online (Sandbox Code Playgroud)
我想成为 ale 来检索它们在照片对象中具有id1 的所有项目,对此的查询是什么?