$max Computes the maximum value from an array of elements. All elements must be comparable and of the same type. Template { "maxNumber": { "$max": [1,2,5,4,3] } } { "maxString": { "$max": ["aaa", "zzz", "ggg"] } } Output { "maxNumber": 5 } { "maxString": "zzz" }