我尝试为第一个NoSQL数据库(Firestore)建模,该应用程序反映民主组织(例如政党)关于想法的决定。
因此,如果您能回顾一下我的NoSQL概念并给我一些改进的技巧,我将不胜感激。如果您喜欢这个主意,并且想支持该项目,请查看git-repo: https://github.com/Donnerstagnacht/leftlife
因此,我想到了具有以下属性的民主思想模型:
// attributes of the idea
ideaID: string;
location: string;
image: string;
video: string;
text: string;
hashtags?: Object[];
date?: string;
用户现在可以执行以下操作:
用户和应用程序还将定期执行以下操作:
要完全呈现想法视图,我必须检索有关以下内容的不同信息:
考虑到这一点,我想创建6个收藏集:
...执行以下查询以呈现IdeaComponent的视图
// the idea has an author
// query idea collection to retrieve
userID: string;
userName: string;
userImage: string;
// user can add comments
// query comment collection to retrieve
commentID: string;
commentText: string;
commentAuthorName: string; // userName
commentAuthorID: string; // userID
commentAuthorImage: string; // userImage
// user can add proposals how to change the idea
// query proposal collection to retrieve
proposalID: string;
proposalText: string;
proposalAuthorName: string; // userName
proposalAuthorID: string; // userID
proposalAuthorImage: string; // userImage
// user discuss the idea at real life events
// query event collection to retrieve
eventID: string;
eventAuthorName: string;
eventAuthorID: string;
eventAuthorImage: string;
// user can like the idea
// query user collection to retrieve
userID: string;
userName: string;
userImage: string;
// groups can support the idea
// query groups collection to retrieve
groupID: string;
groupName: string;
groupImage: string;
答案 0 :(得分:0)
有两种方法可以对数据建模:
检查文档: https://firebase.google.com/docs/firestore/data-model
即:我删除了ideaID,因为它将自动生成。
export interface IdeaModel {
location: string;
image: string;
video: string;
text: string;
hashtags?: Array<string>;
date?: Date;
}