Database
Database Interface
Overview
The Database interface provides AQL (Antelope Query Language), a database-agnostic query API. Each module implements this generic interface with the database engine of its choice. AQL offers a chainable, type-safe query builder that works identically across all supported backends, so your application code remains portable regardless of the underlying database.
Documentation Structure
- 1. Query Types - Detailed reference for each query type:
- Table - Table-level operations (insert, get, getAll, between)
- Selection - Multi-document operations (update, replace, delete)
- SingleSelection - Single-document operations
- Stream - Transformation, filtering, aggregation, joins, and grouping
- Change Feeds - Real-time change notifications
- Query - Base query execution and async iteration
- Datum - Single-value manipulation
- ValueProxy - In-query value operations (arithmetic, string, date, array, object)
- 2. Operations - Practical guides:
- Schema Management - Create and manage schema instances
- Table Operations - Access and work with tables
- CRUD Operations - Create, read, update, and delete documents
- Index Management - Define and use secondary indexes
- Filtering and Querying - Filter, compare, and transform data
- Lookup - Foreign key joins and data population
- 3. Results - Result types and handling:
- Insert Results - Results from insert operations
- Index Definitions - Index configuration in schema definitions
- Table Definitions - Table structure and field types
- Schema and Instance Management - Schema lifecycle and instance management
- Change Events - Change feed event structure
Features
- Database-agnostic query interface
- Consistent API across different database implementations
- Type-safe operations using TypeScript generics
- Schema-based database structure definition
- Multi-instance support per schema
- Secondary index support
- Change feeds for real-time updates
- Async iteration with cursor support
- Chainable query builder with lazy evaluation
Database Interoperability
AQL decouples your application logic from the database engine. The same query code works with any backend that implements the interface, such as MongoDB, RethinkDB, or other community-provided implementations. This reduces migration cost and keeps your code portable.