记一次使用mongoose的使用

常用查询javascriptmodel.comment.findByIdAndUpdate(id,{$push:{'replyBody':obj}},{new:true}).exec(function(err,doc){if(doc){resolve(doc)}})$push为schems设计中为数组的元素追加内容,update方法默认不返回数据,只返回更新是否成功,传入这个参数{new:true
- 前端技术
- 2019-05-14 11:18:58
- 317已阅读