📜  仅当 addToSet 更新时才更新字段 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:50.253000             🧑  作者: Mango

代码示例1
const filter = { _id: postId, whoLikes: { $ne: userId }}
const update = { 
    $addToSet: { whoLikes: userId },
    $inc: { likesCount: 1 }
}
const options = { new: true }