Modify multiple matching array values

I tried to modify array values with following :

        final UpdateResult ur = operations.updateMulti(
                new Query().addCriteria(
                new Update().set(String.format("%s.$","tags.applications"), 8),

the problem is, if the array is like tag: application: [1,2,3,4,4,5,6] If I use above “$” update, it could only update the first matched “4”, but I want to update all “4” to “8”, what should I do ? I use spring MongoTemplate.