Database

[{name:"test-document",appliesTo:{profiles:{Profile1:3,Profile2:1},tags:{Tag1:7,Tag2:1}}}]

Query

db.collection.update({name:"test-document"},[{$set:{"appliesTo.profiles.Profile2":{$cond:[{$gt:["$appliesTo.profiles.Profile2",1]},{$add:["$appliesTo.profiles.Profile2",-1]},"$$REMOVE"]}}}])

Result