Updating field by summing values

See this post, which uses $set (aggregation) on Java with mongo-java-driver/4.0/ . You need to use this Java driver API for update with aggregation: updateMany.