Skip to main content
The Query Builder’s filter() method allows you to add conditions to your queries for precise data retrieval.

Overview

Filtering allows you to retrieve only the records that match specific conditions:

Filter Operators

String Filtering

Number Filtering

Date Filtering

Boolean Filtering

Multiple Filters

Multiple filters are combined with AND logic:

Raw Filter Strings

For complex conditions, use raw filter strings:

Raw Filter Operators

Complex Examples

OR Condition

Nested Conditions

Select Fields in Filter

Filter on Relations

Filter on expanded relations:

Case Sensitivity

Text filters are case-insensitive by default:

Null Handling

Check for null/empty values:

Filter Best Practices

1. Use Specific Filters

2. Combine with Indexes

Filter on indexed fields when possible for better performance:

3. Use Pagination with Filters

Always paginate filtered queries:

Complete Example

Next Steps