Update $inc and $set in OmngoDb

In Stock Price Checker I need update two fields I cannot find the manuals of that and this my solution so far.
increment is create new on if no one is in db, upsert :true is similar for whole collection.
If I using them separatly they working. In this case only the second push.
https://specify.io/how-tos/mongodb-update-documents#UpdateFieldsMultiDocuments

  var likenum = req.query.like ? 1 : 0;
 db.collection("finance1").updateOne(query,
                  ({
                    $inc: {
                      like: likenum
                    }
                  }, {
                    $push: {
                      "ip": req.ip
                    }
                  }),

                  {
                    upsert: true
                  },

were you asking about the multi param?
https://docs.mongodb.com/manual/reference/method/db.collection.update/#multi-parameter

1 Like

i thank you match I had stuck for hours.

1 Like