【发布时间】:2015-06-09 17:45:23
【问题描述】:
我有一个带有“选项”属性的集合,但它是 Mongoose 中的保留字。 我不想更改我在 MongoDB 中的整个集合以避免这个问题,所以我想知道在 Mongoose 中定义新模式时是否可以自定义映射。
这是我当前的架构
var QuestionSchema = new Schema({
question: {
type: String,
required: true,
trim: true
},
answer: {
type: String,
required: true
},
options: [String]
});
也许我可以在 Mongoose 中使用 ops 而在 MongoDB 中使用 options
谢谢
【问题讨论】:
标签: mongoose mean-stack