Documents
Store JSON documents in collections, read them by id or scan a collection, and see earlier versions.
Documents are JSON objects stored under a collection and an id, for example carts/7f3a…. Use them for data that doesn't fit neatly in tables: settings, carts, drafts, events. Collections can be nested (orders/123/notes).
Write and read
await sovaria.data.docPut('carts', userId, { items: [{ sku: 'BK-1', qty: 2 }] })
const cart = await sovaria.data.docGet('carts', userId)
await sovaria.data.docDelete('carts', userId)
// List documents in a collection
const { documents } = await sovaria.data.docScan({ prefix: 'carts', limit: 50 })Ids and paths
- Ids may contain letters, digits,
-and_(they may start with a digit). - Writing to an existing id replaces the document.
- Each write gets a transaction id; pass
atTxidtodocGetto read the document as it was then.
Who can read and write
Every document records the app user who created it. App users can only read and change documents your project policies allow — by default, their own. Set rules per collection under Policies; console members and the service role key are not limited.
From the CLI
sov collections listSomething unclear or missing on this page?Tell us