使用以下组架构,role.name只能在组中唯一吗?我希望能够将同一个角色名称存储到同一组中的另一个组按钮中...
/**
* Role Schema
*/
const Role = new mongoose.Schema({
name: { type: String, required: true, unique: true },
description: { type: String, required: false }
});
/**
* Group Schema
*/
const GroupSchema = new mongoose.Schema({
name: { type: String, index: { unique: true, required: true, dropDups: true } },
description: { type: String, required: false },
roles: [Role],
createdAt: {
type: Date,
default: Date.now
}
});