await model.photo.update({
_id: {
$in: photoIdsParam
}
}, {
$pull: {
customerIds: {
code: custCode,
$or: [{
'userIds.0': {
$exists: false
}
}, {
'userIds.0': ctx.user.userid
}]
}
}
}, {
multi: true
})
await model.photo.update({
_id: {
$in: photoIdsParam
}
}, {
$addToSet: {
customerIds: {
userIds: ctx.user.userid,
code: custCode,
isDel: 'true'
}
}
}, {
upsert: true,
multi: true
})