【发布时间】:2022-01-15 08:03:46
【问题描述】:
想知道是否有人知道我如何为以下模型开发架构,所有字段都是必需的。
我想要捕获的数据
{
“名称”:“商店”,
“地址”: {
"line_one":"乔博客大道 123 号",
"line_two":"1区",
"city":"随机城市",
"邮编/邮编":"AB12 3BJ"
},
"coverImage":"imageURL",
“评分”:4.5
}
const placeSchema = mongoose.Schema({
name: {
type: String,
required: true,
address: {
line_one: {
type: String,
required: true,
},
line_two: {
type: String,
required: true,
},
city: {
type: String,
required: true,
},
postcode: {
type: String,
required: true,
},
},
},
coverImage: {
type: String,
rating: {
type: mongoose.Types.Decimal128,
},
},
});
在发布数据时,我只发现返回了名称、封面图片、_id 和 __v。
【问题讨论】: