Zum Inhalt springen
Aurabase-Logo
Aurabasis

NoSQL- und Dokumentenspeicher

MongoDB-kompatible dokumentenorientierte Datenbank-Engine. Speichern Sie flexible JSON-Datenstrukturen, indizieren Sie Ihre Sammlungen und führen Sie komplexe Aggregationspipelines aus.

Erklärung9 Min. gelesenEbene Mittelstufe

Die englische Quelle hat sich seit dieser Übersetzung geändert. Einige Informationen sind möglicherweise veraltet.
Diese Seite wurde automatisch übersetzt. Maßgeblich ist die englische Version.

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).

Recommended use cases

Choose the NoSQL engine for tracking/analytics events, product catalogs with heterogeneous attributes, real-time telemetry and user sessions.

A MongoDB project is required

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 your apikey) or the @aurabase/aurabase-js SDK.

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?#

CriterionPostgreSQL (relational)Document store (NoSQL)
StructureStrict schema, versioned migrationsDynamic schema without rigid constraints
Relations and joinsSQL joins and foreign keysNested or denormalized documents
Access controlDeclarative row-level security (RLS) in SQLPermissions by collection and role token
Vector searchNative pgvector with HNSWFiltering by attributes and text indexes
Best forCore banking, B2B SaaS, rights managementLogs, dynamic catalogs, IoT, events

To go further#

@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ Ein Problem melden