NoSQL & Document Store
Moteur de base de données orienté documents compatible MongoDB. Stockez des structures de données JSON flexibles, indexez vos collections et exécutez des pipelines d'agrégation complexes.
The Aurabase document store#
In addition to the PostgreSQL relational engine, Aurabase allows you to activate a NoSQL Document Store engine isolated by project. It offers the flexibility of semi-structured documents with the robustness of the Aurabase infrastructure (backups, access control, observability).
Choose the NoSQL engine for tracking/analytics events, product catalogs with heterogeneous attributes, real-time telemetry and user sessions.
The /v1/nosql routes only exist on a project created with the MongoDB engine. On a Postgres project they answer 400 « NoSQL routes (/v1/nosql) are only available on MongoDB projects ». Create one with aura projects create my-events --engine mongodb, or choose the engine in the console, then use that project's URL and keys for the examples below.
Collection operations#
Who can read and write a collection#
Access is private by default and isolated per owner. Every document is stamped with the user who wrote it, and a signed-in user only reads and writes their own documents. A request with no user (the anon key alone) is refused with 403 — « Read refused: no user identity to apply per-owner isolation » — unless the collection is explicitly made publicly readable. A service_role key bypasses the isolation.
To make a collection readable by everyone, open it in Studio › Database and click Make public (writes stay isolated per owner, and the owner field is never returned). The same switch is available on the management plane, with a console token: PUT /v1/db/{project_id}/schema/tables/{collection}/public-read with {"public_read": true}.
Engine optimized for production#
- Flexible schema. Dynamic JSON/BSON documents. Ideal for logs, e-commerce catalogs, IoT telemetry and non-standardized profiles.
- Query operators.
$eq,$ne,$gt,$gte,$lt,$lte,$in,$nin,$regex(simple patterns) and$exists, on top-level fields and nested paths such as'metadata.country'. An operator the engine does not support is rejected with an explicit error, never ignored, so a filter never silently returns more than you asked for. - Aggregation pipelines. Multi-step transformations with $match, $project, $group, $sort, $unwind and streaming metric calculations.
- Indexing. Simple, compound, text indexes for full-text search and TTL indexes with automatic purge of expired documents.
- Explain and profiling. Detailed execution plan for each query (COLLSCAN vs IXSCAN, execution time, indexes used).
- REST API and SDK. Direct access via REST endpoints
/v1/nosql/{collection}(on your project's URL, with yourapikey) or the@aurabase/aurabase-jsSDK.
Query Optimization (Explain)#
Call aura.nosql.collection('events').explain({ type: 'user_signup' }) to get the plan of a filter.
Each query can be analyzed to inspect the execution steps, identify if an index was requested (IXSCAN) or if a full scan took place (COLLSCAN):
{
"queryPlanner": {
"winningPlan": {
"stage": "IXSCAN",
"indexName": "metadata.country_1_timestamp_-1",
"keysExamined": 42,
"docsExamined": 42
},
"executionTimeMillis": 1.2
}
}PostgreSQL vs NoSQL: Which engine to choose?#
| Criterion | PostgreSQL (relational) | Document store (NoSQL) |
|---|---|---|
| Structure | Strict schema, versioned migrations | Dynamic schema without rigid constraints |
| Relations and joins | SQL joins and foreign keys | Nested or denormalized documents |
| Access control | Declarative row-level security (RLS) in SQL | Permissions by collection and role token |
| Vector search | Native pgvector with HNSW | Filtering by attributes and text indexes |
| Best for | Core banking, B2B SaaS, rights management | Logs, dynamic catalogs, IoT, events |