Access Control

Set per-operation access rules in the schema:

LevelMeaningRequired header
publicAnyone (with public key)X-Public-Key
authenticatedValid user JWTAuthorization: Bearer
ownerOnly own rowsAuthorization: Bearer
adminAdmin key onlyX-Admin-Key
"access": {
  "read": "public",
  "create": "authenticated",
  "update": "owner",
  "delete": "admin"
},
"owner_field": "user_id"
When any access rule is "owner", you must set owner_field to a ref column pointing to the auth table (e.g. "user_id"). How it works:
Read/Update/Delete: MoonDB compares the owner_field value with the user id from the JWT — users can only access their own rows.
Insert: if the user is authenticated and doesn't provide the owner_field value, MoonDB auto-fills it from the JWT.
• For the auth table itself, use "owner_field": "id" (a user owns their own row).

Common patterns

Use caseAccess config
Public blogread: public, create/update/delete: admin
Social feedread: public, create: authenticated, update/delete: owner
Private notesall: owner
Admin-only configall: admin