Hi everyone,
I been working trying to solve this for two days but haven’t find why the document is not updated.
My query is:
payment.updateOne({ “contratct”: ${value1}
}, { $inc: { “Balance”: value2 } }, {upsert: true})
The query returns:
{ “acknowledged”: true,
“modifiedCount”: 1,
“upsertedId”: null,
“upsertedCount”: 0,
“matchedCount”: 1 }
But when checking the document the fields have the same old value. if the updateone changes a STRING type field, the modification works but with numbers it isn`t working.
The field Balance is type: Double
Same thing happens if I want to $push a new element to an empty array inside the document. The query returns modifiedCount: 1 but there’s no change in the collection document.
Please if somebody can tell me what is happening, because in other collections I’m updating strings without any problem, but numbers doesn’t work.