【发布时间】:2021-05-04 01:17:44
【问题描述】:
我正在尝试创建一个如下所示的架构:
const exampleSchema = mongoose.Schema({
topic: {
type: String,
required: true,
},
words: {
type: String || Array: {
type: String,
required: true,
}
required: true,
}
});
我已经阅读了 mongodb 中的自定义类型,但不明白文档向我展示的内容。谁能帮帮我?
【问题讨论】:
-
这能回答你的问题吗? Boolean and Number in Schema (Mongoose)
-
遗憾的是,但这对我来说太复杂了。我不明白如何创建它,也不知道它是如何工作的。我编辑了我的问题,希望有人可以帮助我!
标签: javascript database mongodb mongoose