When trying to use $inc to increase the value of a property in Mongodb, the value remains unchanged.
let stats = {stress: -5, affection: 0, darkness: 0}
await Data.findOneAndUpdate({UserID: this.userID},
{
$inc: {
Stress: stats.stress,
Affection: stats.affection,
MentalDarkness: stats.darkness
}
}
)
I was expecting these stats to change accordingly and yes I did check that these variables returned what they were meant to. It works if I type the numbers instead of giving it a variable.