Skip to content

$int

Returns a random BSON Integer (32-bit) number.

Aliases: $integer, $number, $int, $mgNumberInt, $int32

Options

  • min (optional) minimum value. Default -2^31.
  • max (optional) maximum value. Default 2^31.

Example

{
    "price": {
        "$int": { "min": 100 }
    }
}
{
    "price": 7647
}