AD *_*ark 6 android nosql firebase firebase-realtime-database google-cloud-firestore
我将开发 android 移动应用程序并使用 Firebase 作为后端。我是 NoSql Firestore 的新手。
在我的应用程序中,用户有很多主题。一个主题有很多帖子,帖子有很多评论和一张图片。用户也有很多追随者。
在这种情况下,如何根据我的要求设计 Firestore 数据库以及最佳实践是什么?如何减少阅读次数?
以下结构适合我的要求吗?
Firestore-root
|
--- Topic (collections)
| |
| --- topicId (document)
| |
| --- topicId: "345"
| |
| --- title: "Topic Title"
| |
| --- viewCount: 20
| |
| --- likeCount: 30
| |
| --- Posts (colletion)
| | |
| | --- postId
| | |
| | ---postId: "321"
| | |
| | ---Title: "My title"
| | |
| | --- Image: ' '
| | |
| | --- commentsCount: 1
| | |
| | --- comments (colletion)
| | |
| | --- commentId
| | |
| | ---commentId: "123"
| | |
| | ---comment: "My Comment"
| | |
| --- likes (colletion)
| | |
| | --- likeId (document)
| | |
| | --- userId: true
| |
|
|
--- Users (collections)
| |
| --- userId (document)
| |
| --- userId: "345"
| |
| --- name: "Test Name"
| |
| --- followersCount: 20
| |
| --- followingCount: 30
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5154 次 |
最近记录: |