> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lumi.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Databases

> Managing your web's data.

In Lumi, **data** is the structured information that powers the dynamic functionality of your app, including users, content, orders, and more. This information is organized within **tables**, which function similarly to a database or spreadsheet. Each table consists of **fields** (columns), and each field holds a specific type of information.

## Working with data

### How to add database to your project.

Generally, Lumi will automatically analyze your needs and add this function when a database is required. You can also emphasize it in the prompt, such as "Create an orders management system with a database to store orders data."

### Manually add a record

<img src="https://mintcdn.com/blockdance/ynWgEA-zeP9dMZPg/images/4.gif?s=75cbccfd591bb323b1fbd898803601df" alt="4 Gi" width="1276" height="720" data-path="images/4.gif" />

<Steps>
  <Step title="Navigate to Your Table">
    Go to Workspace → Data and select the table you want to add data to.
  </Step>

  <Step title="Add a New Record">
    Click the “Add” button and fill in the fields for the new record.
  </Step>
</Steps>

<Tip>
  **Tip:** For a more user-friendly experience, you can ask the chat to build a form within your app, allowing you to add new items dynamically.
</Tip>

### Manually edit a record

<img src="https://mintcdn.com/blockdance/ynWgEA-zeP9dMZPg/images/5.gif?s=5b00a080da6a7e5c3a232793e125aa4b" alt="5 Gi" width="1276" height="720" data-path="images/5.gif" />

<Steps>
  <Step title="Navigate to Your Table">
    Go to Workspace → Data and select the table containing the record you wish to edit.
  </Step>

  <Step title="Edit the Record">
    Click the ✒️ Pen icon for the desired record and make your changes.
  </Step>
</Steps>

### Deleting and batch operations

* To delete a single record

<img src="https://mintcdn.com/blockdance/ynWgEA-zeP9dMZPg/images/6.gif?s=62b77edc88b3b420fc6287c79d218ede" alt="6 Gi" width="1276" height="720" data-path="images/6.gif" />

<Steps>
  <Step title="Navigate to Your Table">
    Go to Workspace → Data and select the table containing the record you wish to delete.
  </Step>

  <Step title="Delete the Record">
    Click the 🗑 Trash Bin icon for the record you want to delete.
  </Step>
</Steps>

* To make a batch deletion

<img src="https://mintcdn.com/blockdance/ynWgEA-zeP9dMZPg/images/7.gif?s=0070d8d21b1fb977381a83c8c44b0486" alt="7 Gi" width="1276" height="720" data-path="images/7.gif" />

<Steps>
  <Step title="Navigate to Your Table">
    Go to Workspace → Data and select the table from which you want to delete records.
  </Step>

  <Step title="Select and Delete Records">
    Select the checkboxes for the records you want to remove, then click the "Delete" button that appears near the selection count.
  </Step>
</Steps>

<Warning>
  **Warning:** Be careful that deletion is irreversible
</Warning>

## Supported field types

1. Basic Data Types

* **String**: A UTF - 8 encoded string used to store text data.
* **Integer**: Includes 32 - bit and 64 - bit integers for storing integer values.
* **Double**: 64 - bit floating - point numbers for storing decimal numbers or large numbers.
* **Boolean**: Stores logical values true or false.
* **Null**: Represents a null value or a non-existent field.

2. Complex Data Types

* **Array**: An ordered collection of elements that can contain different types of data.
* **Object (Embedded Document)**: A collection of key-value pairs that supports nested structures.
* **Date**: Stores date and time represented as UTC milliseconds.

3. Special Data Types

* **ObjectId**: A 12 - byte unique identifier, used by default for the \_id field of a document.
* **Binary Data**: Stores binary data (such as images, files).
* **Regular Expression**: Stores regular expressions for text matching.
* **JavaScript**: Supports storing and executing JavaScript code.

4. Extended Data Types

* **Timestamp**: A 64 - bit timestamp where the first 32 bits are seconds and the last 32 bits are nanoseconds, used to record operation times.
* **Decimal128**: A 128-bit high-precision decimal number, suitable for financial calculations.
* **GeoJSON**: Stores geospatial data.

## Security and table premissions

Each table includes its own security settings to control data access:

* **Read Access:** Defines who is permitted to view the records within the table.
* **Write/Delete Access:** Determines who can create, update, or delete records.

<img src="https://mintcdn.com/blockdance/ynWgEA-zeP9dMZPg/images/image(44).png?fit=max&auto=format&n=ynWgEA-zeP9dMZPg&q=85&s=ab5d3abaf0caa231d6382f8660faf92e" alt="Image(44) Pn" width="2082" height="1236" data-path="images/image(44).png" />
