mongodb - 猫鼬中的updateMany不会更新属性
问题描述
由于某种原因,我无法使用updateMany
mongoose(5.8.10) 更新文档中的属性。这是我的查询:
Booking.updateMany({ sessionId }, { "isPaid": true } );
在开头的文件中,上面sessionId
的isPaid
标志设置为 false。现在我想在所有这些文档中将此标志切换为 false。但是,这不会更新属性。
解决方案
因此,如果没有这样的回调,它似乎无法工作:
Booking.updateMany({ sessionId }, { "isPaid": true }, null, (error, res) => {
if(error) {
console.log("Something went wrong when updating data!");
}
});
推荐阅读
- ios - 有没有计算自定义视图高度的现代方法?
- google-drive-api - “谷歌驱动器托管的网页编辑不起作用”
- c# - 删除具有唯一键的 cosmos 文档而不先获取对象
- css - 如何在 mat-menu 按钮中不换行?
- java - 如何在 ASM 中访问方法内部的注解
- qlikview - 以使订单数据灵活的方式链接报价和订单数据
- google-play - 发生意外的错误。请再试一次。(7854D9A9) 谷歌播放控制台
- django - Django 的 SECURE_SSL_REDIRECT 和 Heroku 导致重定向的 Rest Framework POST 请求变为 GET 请求
- excel - 用标题填充列表框
- python - Python:在以特定单词开头和结尾的DataFrame字符串对象中获取数字