mongoose根据_id更新,且如果数组中没有元素就添加

await model.photo.update({
_id: {
$in: photoIdsParam
}
}, {
$addToSet: {
customerIds: {
code: custCode,
isDel: 'true'
}
}
}, {
upsert: true
})

猜你喜欢

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