Skip to main content

Query & Filtering

Master advanced query techniques including filtering, searching, sorting, and pagination with powerful operators across all platforms.
Cocobase provides a comprehensive query system with support for complex filters, logical operators, and efficient pagination.

Overview

Build powerful queries with:
  • Comparison operators - Equal, not equal, greater than, less than
  • String operators - Contains, starts with, ends with, regex
  • List operators - In, not in
  • Logical operators - AND, OR, NOT combinations
  • Sorting - Order results by any field
  • Pagination - Limit and offset for large datasets
  • Query builder - Fluent, chainable API

Basic Filtering

Filter documents by field values with automatic type handling.

Equality Filters


Query Operators

Comparison Operators

Filter by numeric ranges and comparisons.

String Operators

Search and filter text fields with powerful string operations.

List Operators

Filter by multiple possible values.

Logical Operators

Combine filters with AND and OR logic for complex queries.

OR Queries

Complex Queries (AND + OR)


Sorting

Order results by any field in ascending or descending order.

Pagination

Efficiently handle large datasets with limit and offset.

Query Builder Pattern

Use fluent, chainable APIs for complex queries.

Real-World Examples

Social Feed with Filters


Best Practices

Filter on the server, not the client. This reduces bandwidth and improves performance.
Never fetch all documents at once. Use limit and offset for better performance.
Contact support to add indexes for fields you query often for better performance.
Order filters from most to least selective for optimal query planning.
For complex queries with OR logic, use the query builder pattern.

Operator Reference

Comparison Operators

String Operators

List Operators


Next Steps

CRUD Operations

Learn the basics of creating, reading, updating, deleting

Real-time Updates

Subscribe to live filtered query results

Relationships

Populate related documents in queries

Authentication

Query authenticated user collections