For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add or edit a record

Add a record to a collection, or change one, with the form built from the collection's schema.

Where: Database → Collections → collection → Add New (or Edit on a row) · /projects/<project>/db/collections/<collection>/records/new · …/records/<recordId>/edit

Before you start

  • The collection's schema is published — see Create a schema. Add New is off while the schema is only a draft.

  • You need database:create on the collection (database:collection:<name>) to add, database:update to edit.

Steps

  1. Open Database → Collections, click the collection, and press Add New. The form is titled Add New Record — books (v1): the collection and its published version. Its fields, widgets and tabs come from the schema.

    Add New Record — books (v1): Create a new record in the books collection. One tab Book with the empty fields Title, Pages, an In stock checkbox and a Genre select; Cancel and Create
    The empty record form of books.
  2. Fill in the fields. Switch tabs, if the schema has several, to reach every field.

    Field
    Required
    What it does
    Example

    Title

    yes

    Text, at most 200 characters.

    The Dispossessed

    Pages

    yes

    A whole number, 0 or more.

    387

    In stock

    no

    Yes / no.

    ticked

    Genre

    no

    One value of the list fiction, science, history.

    fiction

    The record form filled in: Title The Dispossessed, Pages 387, In stock ticked, Genre fiction
    The form, filled in.
  3. Press Create. Required fields and formats are checked first; an invalid form is not sent. Cancel goes back without saving.

Result

Cloud goes back to the records list, and the new record is the first row (newest first, unless the List tab sets another sort). The record gets an id (6ac4f314f002ebc3670fbf05), and every schema trigger When inserted runs.

Records list of books with the new row The Dispossessed, 387, True, fiction at the top
The new record in the list.

Change or remove it later

  • Edit — press Edit on the row. The form is titled Edit Record — books (v1), shows the saved values, and its button is Update. Change the values and press Update; When updated triggers run.

    Edit Record — books (v1) for Neuromancer, 271 pages, In stock ticked, Genre fiction; a red Delete button at the top right; Cancel and Update
    Editing a record.
  • Delete — Delete at the top right of the edit form, or Delete... on the row — see Delete a record.

  • The record's owner (schema setting Records have an owner) is not changed here; use changeResponsibility from code.

The API checks inserts and updates against the published schema: a value the schema forbids is refused, from Cloud and from code.

Do it from code

updateOne takes the fields to change, not $ operators (CM-ERRORS-DATABASE-035). The client setup is on the Database page. API: Insert One · Update One · Replace One · Change Responsibility

Last updated

Was this helpful?