Skip to main content

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.

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.
Search for a keyword across multiple fields using the __or__ syntax.

Sorting and Pagination

Sorting

  • orderBy: The field name to sort by.
  • order: Use asc (ascending) or desc (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 the populate parameter.

Single Population

Nested Population


Complete Examples

Complex E-Commerce Query

Get available products in ‘electronics’ between 100100-500, sorted by price.
Find users matching a search term in name or bio who are verified.