node.js - 创建要在 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...
解决方案
推荐阅读
- bitbucket - Bitbucket - 查看与我共享的存储库
- python - 在python中突出显示句子中的特定单词
- c# - WPF DataGrid - 验证错误后如何取消编辑行?
- vue.js - 如何防止 vee-validate 中的意外验证?
- c - 链表中的死锁与移交锁定
- javascript - Javascript:使用 FileSaver.js 将文本/blob 保存到文件中
- python - Mt4Manager API Python Wrapper - 无法获取交易历史
- javascript - 在数组中查找 n 的倍数。(在这种情况下至少是数字 1 的 4 倍)
- javascript - 将外部库(例如 Tabulator)加载到 Google Apps 脚本中
- wordpress - 如何在购物车页面上显示 Woocommerce 图像