【发布时间】:2013-06-06 18:47:03
【问题描述】:
我正在使用 Mongoose.js 创建带有模式的模型。
我有一个模型列表(很多),有时我想获取构成特定模型的属性/键。
有没有一种方法可以提取任何给定模型的属性模式?
例如,
var mySchema = module.exports = new Schema({
SID: {
type: Schema.Types.ObjectId
//, required: true
},
teams: {
type: [String]
},
hats: [{
val: String,
dt: Date
}],
shields: [{
val: String,
dt: Date
}],
shoes: [{
val: String,
dt: Date
}]
}
);
是否可以提取/识别架构[SID, hats, teams, shields, shoes]的属性??
【问题讨论】: