mongoose事务操作,参考官网

https://docs.mongodb.com/manual/reference/method/db.collection.bulkWrite/

 

await model.photo.bulkWrite([{
updateMany: {
"filter":{'customerIds.code': 'VICKY123456'} ,
"update": {'orderHistory': [ {"customerId":'VICKY123456','createdOn':new Date()}]}
}
}])

已实验成功

posted @ 2018-08-14 18:34  江山一族  阅读(3507)  评论(0编辑  收藏  举报