【发布时间】:2018-01-20 12:44:52
【问题描述】:
我有以下数据库结构:
Firestore-root
|
--- users (collection)
| |
| --- userId (document)
| |
| --- //user details
|
--- products (collection)
|
--- listId (document)
|
--- listProducts (collection)
|
--- productId
|
--- //product details
我使用以下代码删除文档:
rootRef.collection("users").document(userId).delete(); //works fine
rootRef.collection("products").document(listId).delete();
第一行代码运行良好,但第二行代码没有删除list 文档。是因为它下面有一个子集合还是我做错了什么?
如何删除整个listId 文档及其下面的所有内容?
谢谢!
【问题讨论】:
-
在调用第二行之前,您能否检查一下您的
listId是否为空? -
@RosárioPereiraFernandes 这肯定不是
null,因为我在其他地方使用该变量并且它有一个值。还有什么想法吗?谢谢
标签: java android firebase google-cloud-firestore