In MongoDB, the $divide
aggregation pipeline operator divides one number by another and returns the result.
To use $divide
, pass the numbers in an array. The $divide
operator will divide the first number by the second number. In other words, the first number is the dividend, and the second number is the divisor.
The arguments can be any valid expression as long as they resolve to numbers.
Continue reading