Overview
Special operators provide range checking and null validation capabilities:between
Check if value is within range
isNull
Check if value is null/undefined
isNotNull
Check if value exists
Architecture
Source:src/operators/special.js | Tests: tests/unit/operators/special.test.js
between - Range Check
Check if a value is within a range (inclusive).
Syntax
Parameters
Value to check - field path or literal
Range as
[min, max] array - literal or field pathReturns
boolean - true if min ≤ value ≤ max, false otherwise
Examples
- Basic Range
- Dynamic Range
- Common Use Cases
Notes
Alternative: You can use
{ and: [{ gte: [value, min] }, { lte: [value, max] }] } for the same effect.isNull - Null Check
Check if a value is null or undefined.
Syntax
Parameters
Field path to check
Returns
boolean - true if value is null, undefined, or field doesn’t exist
Examples
- Basic Null Check
- Optional Fields
- Validation
isNotNull - Not Null Check
Check if a value exists (not null or undefined).
Syntax
Parameters
Field path to check
Returns
boolean - true if value exists and is not null or undefined
Examples
- Basic Existence Check
- Required Fields
- Conditional Logic
Notes
Inverse:
isNotNull is equivalent to { not: [{ isNull: [field] }] }Common Patterns
Age Range Validation
Age Range Validation
Price Filter
Price Filter
Optional Field Handling
Optional Field Handling
Score Validation
Score Validation
Error Handling
Invalid Range Format
Invalid Range Format
Non-Numeric Values
Non-Numeric Values
Missing Arguments
Missing Arguments
Quick Reference
| Operator | Purpose | Example | Result |
|---|---|---|---|
between | Range check (inclusive) | { between: [25, [18, 65]] } | true |
isNull | Check if null/undefined | { isNull: ['email'] } | true if null |
isNotNull | Check if exists | { isNotNull: ['name'] } | true if exists |
Related Operators
Numeric
gt, gte, lt, lte
Comparison
eq, neq
Logical
and, or, not
Array
in, notIn
String
contains, startsWith
All Operators
Complete reference
