Suppose I have this document in mongodb collection:
{
"_id": {
"playerId": "113069",
"tournamentId": "197831"
},
"__v": 0,
"playerName": "David WArner",
"pointsTotal": 426
}
I update it using this update query(using mongoose):
await PointsTotal.findOneAndUpdate(
{
_id: {
playerId: player._id,
tournamentId: tournamentId,
}
},
{
$set: {
playerName: playerName,
pointsTotal: totalPoints
},
},
{
upsert: true,
}
);
}
But, if the playerName and totalPoints is same as before updating, will it perform update operation to overwrite these fields and I am able to listen this update in change stream or not?