In MongoDB, the $atan2 aggregation pipeline operator returns the arctangent (inverse tangent) of one value divided by another.
You provide the two values in an array. Each of the two values provided to $atan2 can be any valid expression that resolves to a number.
The return value is in radians.
The $atan2 operator was introduced in MongoDB 4.2.