0
作爲標題。 ActionSchema
下有一個對象屬性vote
。我想訪問vote.type
,但path('vote.type')
不起作用。Mongoose - 是否可以通過模式路徑訪問對象屬性?
ActionSchema = new Schema({
vote: {
type: String
}
});
// TypeError: Cannot call method 'enum' of undefined
ActionSchema.path('vote.type').enum(['upvote', 'downvote']);