Collection scopes
Collections and settings are related, but they solve different problems:- collections are for records
- settings are for configuration
Worked example
This is a common production shape:
A practical way to read the scopes:
appfor a shared lead tableuserfor saved bookmarks for one user of this appownerfor organization-wide reportssessionfor temporary scratch notes
cpsl.Column
Use cpsl.Column when the table needs more than a bare field name. It lets you tell Capsule how a column should be understood and rendered.
Supported column types
textnumbercurrencydatelinkemailstatustagsboolean
Column fields
Example collection declaration:
CollectionRef
CollectionRef is returned by app.collection(...).
Common methods
Inserted documents get both
_id and id.
Typical CRUD flow:
Update behavior
Plain update dicts are treated as patches and automatically wrapped in$set:
session.db
Inside a live session, session.db gives you scoped collection access:
user, owner, and session collections, where the live session already knows which scope to use.
Example:
Settings declarations
Declare settings withapp.setting(...):
Arguments
A fuller example:
app.settings
The settings accessor methods are async:
Practical guidance
Use collections for records the app needs to query later. Use settings for configuration that users or operators should be able to tweak. Usesession.data for conversational scratch state that only matters inside the current session. Add typed Column metadata when the table needs richer rendering or clearer labels.