본문으로 건너뛰기
아우라베이스 로고
아우라베이스

NoSQL 및 문서 저장소

MongoDB와 호환되는 문서 지향 데이터베이스 엔진입니다. 유연한 JSON 데이터 구조를 저장하고, 컬렉션을 색인화하고, 복잡한 집계 파이프라인을 실행하세요.

설명9분 읽기레벨 중급

이 번역 이후 영어 소스가 변경되었습니다. 일부 정보는 최신 정보가 아닐 수 있습니다.
이 페이지는 자동으로 번역되었습니다. 영어 버전은 권위가 있습니다.

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↗ 문제 신고