我想知道如何将roles
转换为地图?通常我会myDocument.roles.id("myRoleID")
会做myDocument.roles.get("myRoleID")
吗?
const { Schema } = require("mongoose")
module.exports = new Schema({
roles: [new Schema({
_id: {
type: String,
required: true
},
permission_level: {
type: Number,
default: 0,
enum: [0, 1, 2, 3]
},
auto_role: {
type: Boolean,
default: false
},
joinable: {
type: Boolean,
default: false
}
})],
})