Questions tagged «mongoose-schema»

3
如何在猫鼬中创建和使用枚举
我试图enum在猫鼬中创建和使用一种类型。我检查了一下,但没有得到正确的结果。我enum在猫鼬模式中使用如下: var RequirementSchema = new mongoose.Schema({ status: { type: String, enum : ['NEW', 'STATUS'], default: 'NEW' }, }) 但是我在这里有点困惑,我怎样才能将enumlike的值放入Java NEW("new")。如何enum根据数据库的枚举值将其保存到数据库中。我在express node.js中使用它。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.