Filtering Guide
Cocobase provides a powerful, MongoDB-inspired query interface for your documents. You can filter, search, sort, and paginate using simple URL parameters or SDK method calls.Query Operators
Use operator suffixes on field names to perform advanced comparisons.| Operator | Suffix | Example | Description |
|---|---|---|---|
| Equal | (none) | status=published | Exact match |
| Not Equal | __ne | status__ne=draft | Not equal |
| Greater Than | __gt | price__gt=100 | Greater than |
| Greater or Equal | __gte | age__gte=18 | Greater than or equal |
| Less Than | __lt | price__lt=1000 | Less than |
| Less or Equal | __lte | stock__lte=10 | Less than or equal |
| Contains | __contains | title__contains=hello | Case-insensitive search |
| Starts With | __startswith | name__startswith=john | |
| Ends With | __endswith | email__endswith=.com | |
| In Array | __in | status__in=a,b | Value in comma-separated list |
| Not In Array | __notin | status__notin=c,d | Value not in list |
| Is Null | __isnull | deleted__isnull=true | Check if field is null |
Boolean Logic
AND Queries (Implicit)
By default, multiple query parameters are combined with AND logic.OR Queries
Use the[or] prefix to create OR conditions.
Named OR Groups
Group multiple OR conditions together. Groups are ANDed with other filters.Multi-field Search
Search for a keyword across multiple fields using the__or__ syntax.
Sorting and Pagination
Sorting
orderBy: The field name to sort by.order: Useasc(ascending) ordesc(descending).
Pagination
limit: Number of items to return (default 20, max 100).offset: Number of items to skip.
Relationships (Population)
Fetch related documents in a single request using thepopulate parameter.
