Database

[{firstName:"FIDO",secondName:"JOHN"},{firstName:"blue",secondName:"streak"},{firstName:"verylongname",secondName:"ANOTHER"}]

Query

db.collection.update({},[{$set:{firstName:{$concat:[{$toUpper:{$substrCP:["$firstName",0,1]}},{$toLower:{$substrCP:["$firstName",1,{$subtract:[{$strLenCP:"$firstName"},1]}]}}]},secondName:{$concat:[{$toUpper:{$substrCP:["$secondName",0,1]}},{$toLower:{$substrCP:["$secondName",1,{$subtract:[{$strLenCP:"$secondName"},1]}]}}]}}}],{multi:true})

Result