Real-Time — MDDB API

Server-Sent Events stream #

GET /v1/events

Subscribe to real-time events via SSE.

Document events: doc.added, doc.updated, doc.deleted.

Async job events: job.started, job.progress, job.completed, job.failed, job.cancelled — so a client can watch a bulk import finish instead of polling its status endpoint. Job events carry the same record GET /v1/bulk/jobs/{id} returns, under a job key. job.progress is throttled to one event per second per job; terminal events are not throttled.

A scheduled backup (2.18.9) is a job too: its id is backup-<ruleId>-<UTC time>, its collection * (read permission on every collection is needed to see it), total 4 and one job.progress per step (written, hashed, stored, pruned).

Default enabled (MDDB_SSE_ENABLED=false to disable).

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
collection query string Filter events to a specific collection (optional)
job query string Filter to one async job's events. A connection with this parameter receives that job's events only — no doc.* events — since a client asking for one job's stream wants the job, not every document change. Combines with collection.

Responses #

Status Description Body
200 SSE event stream string (text/event-stream)
401 Auth is on and the request carries no valid credentials ErrorResponse (application/json)
403 No read permission on the collection asked for ErrorResponse (application/json)
429 Too many SSE connections from this IP, or the API rate limit (MDDB_RATE_LIMIT_ENABLED) ErrorResponse (application/json)
503 SSE is disabled (MDDB_SSE_ENABLED=false) ErrorResponse (application/json)