也许第二组眼睛可以看出我的架构有什么问题
var UserSchema = new Schema({
name:
{
first : {type: String}
, last : {type : String}
}
, password: {type: String}
, username: {type: String}
, role: RoleSchema
, created_at : {type : Date, default : Date.now}
, modified_at : {type : Date, default : Date.now}
})
var RoleSchema = {
type: [String]
, study_type: [String]
}
mongoose.model('User', UserSchema)
Run Code Online (Sandbox Code Playgroud)
错误:
TypeError: Invalid value for schema path `role`
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3092 次 |
| 最近记录: |