I am trying to update an array of ids with an additional item but I require the following: 1. if it exists then obviously it's not duplicate 2. if a new item is added it done on top of the array
Schedule.update(
{ date: "10/4/2018" },
{ $addToSet: { games: <id> }},
{ upsert: true },
function(err, update){
})
Thanks,
Kris