Basic Syntax
Filters use the following format:- field: The name of the field to filter
- operator: The comparison operator to use
- value: The value to compare against (optional for some operators)
Example
Comparison Operators
The framework supports both modern ($ prefixed) and deprecated operators.
Equality Operators
Comparison Operators
String Operators
Case-Insensitive String Operators
All string operators have case-insensitive variants with theL suffix:
Array Operators
Case-Insensitive Array Operators
Null Operators
Null operators do not require a value parameter. The syntax is:
filter={field}||{operator}Multiple Filters (AND)
You can apply multiple filters to create AND conditions:OR Conditions
Use theor parameter for OR logic:
Combining AND and OR
You can combine bothfilter (AND) and or parameters:
isActive = true AND (name = 'John' OR name = 'Jane')
Advanced Search
For complex queries, use thes (search) parameter with JSON:
Simple Search
With Operators
Complex OR Conditions
Nested AND Conditions
Filtering Nested Fields
You can filter by nested object fields using dot notation:Type Conversion
Values are automatically parsed to the correct type:Practical Examples
E-commerce Filters
User Management
Content Management
Error Handling
Invalid filters will throw aRequestQueryException:
Best Practices
- Use modern operators: Prefer
$eq,$gt, etc. over deprecated operators - Use case-insensitive operators: Use
$eqL,$contLfor user input to avoid case sensitivity issues - Validate user input: Always validate and sanitize filter values from user input
- Index filtered fields: Add database indexes to fields commonly used in filters
- Combine with pagination: Always use
limitwhen filtering to prevent large result sets - Use appropriate operators: Choose the right operator for the data type (e.g.,
$betweenfor ranges)
Next Steps
Sorting
Learn how to sort filtered results
Pagination
Paginate through filtered data
Relations
Filter related entities with joins
Query Parameters
Overview of all query parameters