MongoDB change streams, typed.
Open a change stream on any collection. Basalt flattens documents into typed columns and keeps your views current.
Open a change stream on any collection. Basalt flattens documents into typed columns and keeps your views current.
Basalt opens a change stream with fullDocument set to updateLookup. It snapshots each collection first, then resumes from the stored resume token. Nested fields are flattened into columns, and new fields are added as they appear.
Pass a connection string for a replica set or Atlas cluster. The user needs read and changeStream on the collections you pick.
# stream users and sessions from Atlas basalt source add accounts --mongodb atlas-prod --collections users,sessions
Write plain SQL over the source. Basalt keeps the view current with every record and tracks lineage back to the topic, partition and offset.
CREATE MATERIALIZED VIEW revenue_by_min AS SELECT date_trunc('minute', ts) AS minute, currency, sum(amount) AS revenue, count(*) AS payments FROM payments WHERE status = 'captured' GROUP BY 1, 2;
Every view is an endpoint the moment it exists. Call it over REST, connect with any Postgres client, or use the SDK from your app.
curl https://api.basalt.dev/v1/views/revenue_by_min?limit=5 \ -H "Authorization: Bearer $BASALT_TOKEN"
Tokens are stored with each write, so a restart picks up at the exact change.
Nested fields become typed columns. Arrays can be kept as JSON or unnested.
Works with Atlas M10 and above and with self-managed replica sets.
On MongoDB 6.0+, deletes and updates can carry the document before the change.