Answers for "Updated fields only if addToSet get updated"

0

Updated fields only if addToSet get updated

const filter = { _id: postId, whoLikes: { $ne: userId }}
const update = { 
    $addToSet: { whoLikes: userId },
    $inc: { likesCount: 1 }
}
const options = { new: true }
Posted by: Guest on October-13-2021

Browse Popular Code Answers by Language