Mongoose阻止将默认值分配给枚举

时间:2016-04-08 15:44:07

标签: mongodb mongoose mongodb-query mongoose-populate

我在Mongoose模式中定义的对象中有以下属性,有没有办法阻止Moongose在App.create()上或在上传期间分配默认枚举值

band_collection: {
    type: String,
    enum: COLLECTIONS.concat('Custom')
}

// collection

COLLECTIONS = ['red', 'white', 'blue']

1 个答案:

答案 0 :(得分:0)

嗯,不应该发生,据我所知,该代码看起来是正确的。你能提供更完整的代码示例吗?

相关问题