相关疑难解决方法(0)

Firestore 文档/子集合不存在

我有这个数据库结构:

Firestore-root
|
--- sites (collection)
|     |
|     --- common (document)
|            |
|            --- //templates (collection)
|            |
|            --- //menus (collection)
|            |
|            --- //articles (collection) <----
|     --- other (document)
|            |
|            --- //articles (collection)
Run Code Online (Sandbox Code Playgroud)

当我尝试将文章添加到数据库(如箭头所示)时,“common”和“other” - 文档为斜体,因此不存在。

我尝试添加时的代码:优先级很常见,类型是文章。

def documentReference = firestoreClient.databaseReference.collection(siteName).document(priority).collection(TYPE).document(key)
documentReference.set(article)
Run Code Online (Sandbox Code Playgroud)

这是控制台: Firestore 控制台图像

这是构建我的数据库的糟糕方法还是有快速修复?

我曾尝试先创建子集合,但没有任何运气!

firebase google-cloud-firestore

1
推荐指数
1
解决办法
1622
查看次数

标签 统计

firebase ×1

google-cloud-firestore ×1