I'm working with MongoDB and I wanted to add something to a set, depending on some conditions.
So, say if someone did x then it would add to a set called y, but if someone did y it would add to a set called x.
My first thought was the ternary operator, and I used the following code:
let toAdd = x ? 'y' : 'x'
// Jump cut to $addToSet
$addToSet: {
 toAdd: 'thing'
}
However, this doesn't actually add anything to the database. How could I specify a certain set using a variable?
