Syntax
Arguments
List of arguments to provide.A function that takes a document as input and returns a boolean value. Documents for which the
predicate returns
true will be included in the result.Optargs
No optional arguments.Returns
Behavior
- The
filterfunction evaluates the predicate for each document in the sequence. - Only documents for which the predicate returns
trueare included in the result. - The original sequence is not modified; a new filtered sequence is returned.
- If no documents match the predicate, an empty sequence is returned.
Notes & Caveats
- The predicate function can only have query builder expressions in its body.
- The predicate function receives a single document parameter.
- Use
fieldto access specific fields within the document. - Complex predicates can be built using logical operators like
and,or, andnot.
Example
Filter users by age
Filter for users in theusers table where the user’s age is greater than or equal to 21.
Filter with nested fields
Filter for orders where the shipping addresscountry is UAE.
Filter with multiple conditions
Filter for orders where the status isshipped and the value is greater than 100.
Related Functions
eq- Logical Equality Operationne- Logical Inequality Operationlt- Logical Less Than Operationle- Logical Less Than or Equal Operationgt- Logical Greater Than Operationge- Logical Greater Than or Equal Operationand- Logical AND Operationor- Logical OR Operationnot- Logical NOT Operationfield- Referencing a Fieldtable- Referencing a Table
Found a typo? Or maybe a broken link? RuloDB is open-source, help us fix it!

