【发布时间】:2021-03-23 03:24:36
【问题描述】:
大家好(快递新手)我正在创建一个模式对象,其中键值为名称:字符串,车辆:数组,图像:字符串,内容:字符串如下
const Logistics = mongoose.model('Logistics', new mongoose.Schema({
name: {
required: true,
type: String,
minlength: 3,
maxlength: 300
},
image: {
type: String,
required: true
},
vehicles: {
type: Array,
required: true,
},
content: {
type: String,
required: true
}}))
当我通过邮递员发送帖子请求时,我得到了这个
{
"vehicles": [],
"_id": "604a011dxxxxxxxxxxxxxxxx",
"name": "Air Freight",
"image": "path",
"content": "940 AirCargo is a Freight Forwarder capable of handling your time-sensitive cargo. We forward Air shipments to every Corner of the globe on a daily basis, ranging from fresh produce to Europe and Americas to Project Equipments to Mining and Power Companies in the Great lakes region. In addition we avail Cargo capacity daily to world destinations through signing block space Agreements with scheduled cargo/passenger carriers to ensure that our solutions to clients are seamless.",
"__v": 0
}
我的问题是车辆不应该是空的...我需要帮助
【问题讨论】:
标签: node.js mongodb express mongoose