Basic Filtering
Filter data using conditions with addCondition(). The foundation of dcupl queries - add conditions to narrow down results based on field values, types, and boolean logic.
Syntax
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attribute | string | Yes | The property to filter on (supports dot notation for deep queries) |
operator | Operator | Yes | Comparison operator: eq, typeof, isTruthy, size (see other pages for find, gt/gte/lt/lte) |
value | any | Yes | Value to compare against. Type depends on operator. |
options.transform | ('lowercase' | 'trim' | 'removeWhitespace')[] | No | Transform both attribute and search value before comparison |
options.invert | boolean | No | Negate the operator result (NOT logic) |
options.arrayValueHandling | 'some' | 'every' | No | For array attributes: 'some' matches any element (default), 'every' requires all match |
Return Type
Returns void. Query state is updated internally. Call items() to get results.
Usage Notes
- Queries are chainable - call addCondition() multiple times
- Default behavior: multiple conditions use AND logic
- Use eq for exact matches, isTruthy for boolean-like checks
- typeof is useful for data validation (finding missing/invalid data)
- Use options.invert to negate any operator (eq + invert = 'not equal')
- Transform option applies to BOTH the data value and your search value
- For text search, see Query Search. For ranges, see Query Range.
Related Methods
Query Search- Text search with find operatorQuery Range- Numeric/date range filteringQuery Logic- AND/OR combinationsQuery Results- Get results with sort/pagination
Examples
Filter by Category
Find all products in a specific category using exact match.
Filter Active Products
Find products that are currently active using boolean filter.
Check In-Stock Items
Use isTruthy to find items with truthy stock values (> 0, true, etc.).
Validate Data Types
Find products where price is actually a number (data validation).
Find Missing Data
Find products without a description (data quality check).
Exclude Values with Invert
Find all products except discontinued ones using invert option.
Case-Insensitive Match
Match brand name regardless of case using transform option.
Filter Array Values
Find products tagged with "featured" using array value handling.
Multiple Conditions (AND)
Combine multiple filters - all must match (AND logic).
Array of Conditions
Pass multiple conditions as an array for cleaner code.