Interface MqlNumber

All Superinterfaces:
MqlValue
All Known Subinterfaces:
MqlInteger

@Sealed @Beta(CLIENT) public interface MqlNumber extends MqlValue
A number value in the context of the MongoDB Query Language (MQL). Integers are a subset of numbers, and so, for example, the integer 0 and the number 0 are equal.
Since:
4.9.0
  • Method Details

    • multiply

      MqlNumber multiply(MqlNumber other)
      The product of multiplying this and the other value.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • multiply

      default MqlNumber multiply(Number other)
      The product of multiplying this and the other value.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • divide

      MqlNumber divide(MqlNumber other)
      The quotient of dividing this value by the other value. This is not integer division: dividing 1 by 2 will always yield 0.5.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • divide

      default MqlNumber divide(Number other)
      The quotient of dividing this value by the other value. This is not integer division: dividing 1 by 2 will always yield 0.5.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • add

      MqlNumber add(MqlNumber other)
      The sum of adding this and the other value.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • add

      default MqlNumber add(Number other)
      The sum of adding this and the other value.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • subtract

      MqlNumber subtract(MqlNumber other)
      The difference of subtracting the other value from this.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • subtract

      default MqlNumber subtract(Number other)
      The difference of subtracting the other value from this.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • max

      MqlNumber max(MqlNumber other)
      The larger value of this and the other value.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • min

      MqlNumber min(MqlNumber other)
      The smaller value of this and the other value.
      Parameters:
      other - the other value.
      Returns:
      the resulting value.
    • round

      MqlInteger round()
      The integer result of rounding this to the nearest even value.
      Returns:
      the resulting value.
      Since server release
      4.2
    • round

      MqlNumber round(MqlInteger place)
      The result of rounding this to place decimal places using the "half to even" approach.
      Parameters:
      place - the decimal place to round to, from -20 to 100, exclusive. Positive values specify the place to the right of the decimal point, while negative values, to the left.
      Returns:
      the resulting value.
    • abs

      MqlNumber abs()
      The absolute value of this value.
      Returns:
      the resulting value.
    • passNumberTo

      <R extends MqlValue> R passNumberTo(Function<? super MqlNumber,? extends R> f)
      The result of passing this value to the provided function. Equivalent to f.apply(this), and allows lambdas and static, user-defined functions to use the chaining syntax.
      Type Parameters:
      R - the type of the resulting value.
      Parameters:
      f - the function to apply.
      Returns:
      the resulting value.
      See Also:
    • switchNumberOn

      <R extends MqlValue> R switchNumberOn(Function<Branches<MqlNumber>,? extends BranchesTerminal<MqlNumber,? extends R>> mapping)
      The result of applying the provided switch mapping to this value.
      Type Parameters:
      R - the type of the resulting value.
      Parameters:
      mapping - the switch mapping.
      Returns:
      the resulting value.
      See Also: