Here's a simplified example of the document
{
"username":"someUsername",
"bank":[
{
"item_id":45,
"item_amount":10
},
{
"item_id":45,
"item_amount":10
}
]
}
How can I increment item_id=45's item_amount value by say 3? And do it in a way where if item_id=45 doesn't exist in the array it will get added and it's item_amount value will be 3.
I believe MongoCollection's updateOne is the newest way to work with mongodb with java. I'd prefer to use that method, I just can't figure out the proper way to do it. (I've found plenty of answers using the old update method, so please don't reference those unless I'm missing something useful from them).