I have such document
{
"_id" : "N4H7gYQwNXwTiEe62",
"createdAt" : ISODate("2020-05-07T20:18:59.144Z"),
"title" : "Two roads",
"userId" : "CnugxoBWs4ox6vG2k",
"awards" : [
{
"type" : "suggested",
"place" : 1.0,
"addedAt" : ISODate("2020-10-23T20:33:58.885Z")
},
{
"type" : "voted",
"place" : 3,
"addedAt" : ISODate("2020-10-23T20:33:58.885Z")
}
]
}
Is it possible to write a query which add a new element in "awards" if "type" is not exists (fexample: new type "removed"), or update if type exists already as "suggested" or "voted". I need to update "place" and "addedAt".