【发布时间】:2019-11-02 02:00:45
【问题描述】:
我使用下面的代码来引用我需要在集合中使用“where”子句删除的特定文档,但我无法弄清楚执行该操作的函数,我在 android java 和 firestore 中使用它数据库
private void deleteDocument() {
final CollectionReference docref = (CollectionReference) db.collection("users").document(CommentAuthorId).collection("notifications_received").whereEqualTo( "comment_id", Comment_Id );
docref.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
Log.d(TAG, document.getId() + " => " + document.getData());
}
} else {
Log.d(TAG, "Error getting documents: ", task.getException());
}
}
});
}
【问题讨论】:
标签: android firebase google-cloud-firestore