试图解决MongoDB中关系的缺点,这是我在我的数据库中尝试的:
楷模:
uid但_id也可用.产品规格:
每个用户都可以是该团队的成员或该应用程序的独立用户.普通用户可以拥有自己的私有项目和资产.
团队成员可以访问团队所有者认为可以访问的资产和项目.
会员可以创建自己的私人资产和项目.
根据成员的角色,成员还可以与其团队成员共享资产.
成员,根据其角色,可以添加,删除,编辑团队资产,删除或重命名团队,添加或删除团队成员.
成员可以查看团队中与他们共享的资产和项目的列表.
成员可以查看单个资产页面,他们可以根据角色在资产中添加删除项目.
成员可以查看,编辑,添加,删除单个项目,具体取决于他们的角色.
目前的架构:
const teamSchema = new Schema({
uid: {
type: String,
required: true
},
name: {
type: String,
required: true
},
members: {
type: [String]
},
brands: {
type: [String]
}
}, { collection: 'team', timestamps: true });
const memberSchema = new Schema({
uid: {
type: String,
required: true
},
owner: {
type: String,
required: true
},
teamID: { …Run Code Online (Sandbox Code Playgroud)