mongoose 根据_id更新数据

 let photoId = mongoose.Types.ObjectId(`${virtual.productId[0]}`)

await model.photo.findByIdAndUpdate(photoId, {
$set: {
photto: photo
}
}, {
upsert: true
})

猜你喜欢

转载自www.cnblogs.com/qiyc/p/9084505.html