有这样一个餐厅集合计划
const PointSchema = new mongoose.Schema({
name: { type: String, required: true },
})
const RestaurantSchema = new mongoose.Schema({
name: {
type: String,
require: true
},
description: {
type: String,
default: ""
},
image: {
type: String,
},
rating: {
type: String
},
sale: {
type: String,
},
time: {
type: String
},
minPrice: {
type: String,
},
priceRange: {
type: String
},
categories: [],
points: [PointSchema]
})

不应该是这样吗?
当被问到时做
find这样的事情:因此,获取的不是元素 id,而是完整的信息
在
mongoose.model2 个参数中传递:集合的名称(s在末尾添加)和先前创建的模式。我不知道你收藏的名字,所以我举个例子。我强烈建议你阅读mongoose文档,这样你以后会遇到这样的问题。