Backend & SDK

Database (m77.db)

Collections, queries, and per-user data.

m77.db is a schemaless document database. Collections are created automatically the first time you write to them.

Create

const task = await m77.db.create('tasks', { title: 'Ship v2', done: false, priority: 2 });
// → { id, title, done, priority, createdAt, updatedAt, ownerId }

Read

const all = await m77.db.list('tasks');
const open = await m77.db.list('tasks', { where: { done: false }, sort: '-priority', limit: 50 });
const one = await m77.db.get('tasks', id);            // null if missing
const count = await m77.db.count('tasks', { where: { done: true } });

Filters

where matches fields exactly, and supports operators:

OperatorExample
equals{ status: 'paid' }
$ne{ status: { $ne: 'draft' } }
$in{ status: { $in: ['sent', 'paid'] } }
$gt / $gte / $lt / $lte{ total: { $gte: 100 } }
$contains{ name: { $contains: 'ann' } } (case-insensitive)

sort takes a field name, prefixed with - for descending (default -createdAt). limit is up to 500, offset paginates.

Update & delete

await m77.db.update('tasks', id, { done: true });   // shallow merge
await m77.db.replace('tasks', id, { title: 'New' }); // overwrite all fields
await m77.db.remove('tasks', id);

Per-user data

Records created while a user is signed in get an ownerId. Query only the current user's records with mine: true:

const myNotes = await m77.db.list('notes', { mine: true });

Records with an owner can only be updated or deleted by that owner.

Access rules

Every collection is public by default. Lock it down per collection in the builder's Data tab, or let your app declare rules in an m77.config.json file:

{ "rules": { "notes": "private", "menu": "readonly", "orders": "auth" } }
RuleWho can readWho can write
publicAnyoneAnyone
authSigned-in app usersSigned-in app users
privateEach user sees only their own recordsOnly the record's owner
readonlyAnyoneOnly you, from the Data tab

Limits

Records up to 1 MB each; 50,000 records per app (contact us for more).