首页 > 解决方案 > 创建要在 mongodb 中发送的数据时出现错误

问题描述

exports.createBootcamp = async (req, res, next) => {
    const bootcamp = await Bootcamp.create(req.body);

    res.status(201).json({
        success: true,
        data: bootcamp
    });
};

错误:

Bootcamp validation failed: location.coordinates: Path `location.coordinates` is required., location.type: Path `location.type` is required. [nodemon] app crashed - waiting for file changes before starting...

标签: node.jsexpressnodemonbootcamp

解决方案


推荐阅读