> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mod

# \$mod

The `$mod` operator returns the remainder after dividing the first numeric value by the second numeric value.

## Input

* An array containing exactly two numeric values (dividend and divisor)

## Output

* The remainder after division (first % second)

## Examples

### Basic Modulo

```json theme={null}
{
  "$mod": [
    10,
    3
  ]
}
```

Result: `1`

### Field Value Modulo

```json theme={null}
{
  "$mod": [
    {
      "$input": "item_count"
    },
    {
      "$input": "group_size"
    }
  ]
}
```

Result: The remainder when item\_count is divided by group\_size

### Decimal Modulo

```json theme={null}
{
  "$mod": [
    10.5,
    3.2
  ]
}
```

Result: `4.1`

### Modulo by Zero Error

```json theme={null}
{
  "$mod": [
    10,
    0
  ]
}
```

Result: Error (division by zero)
