> For the complete documentation index, see [llms.txt](https://docs.cosmocloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmocloud.io/resources/models/building-models.md).

# Building Models

## Understanding requirements

Let us assume we have a student data with given Schema that we need to store in database :&#x20;

```javascript
{
    "id":{
        "type":"objectId",
        "required":true,
    },
    "name":{
       "type":"string",
       "required":true,
    },
    "age":{
        "type":"number",
        "required":true,
    },
    "subjects":{
        "type":"string[]",
        "required":true,
    },
    "address":{
        "city":{
            "type":"string",
            "required":true,
        },
        "state":{
            "type":"string",
            "required":true,
        }
    }

}
```

To build the model with given schema above follow these steps :&#x20;

1. Navigate to Models screen from **Application Layer -> Models**.
2. Click on **Create Model** button and configure models name, description and model type as per your preference. For instance, if you would like to build the Student's DB model above, you can select **Database Collection** model type. You can check other [<mark style="color:blue;">**model types here**</mark>](/resources/models.md).
3. After model is created navigate to **Schema** tab on top of model details page.
4. You can now start building your model's schema.

Models schema for above requirements would appear something like this :&#x20;

<figure><img src="/files/eGUyTRMWsw0r2TvHqIcm" alt=""><figcaption><p>model schema</p></figcaption></figure>

## Supported data types in schema builder

* **ObjectID**: An ObjectID is a unique 12-byte identifier typically represented as a hexadecimal string. These are used to uniquely identify documents in a collection. This can also be used when making references to other IDs of other collections (for ex. a record in *Orders* collection could have a `userId: ObjectId` )
* **Boolean**: Boolean is often used to express binary decisions or states i.e. True or False.
* **String**: A string data type represents text. It can contain letters, numbers, symbols, and spaces. Strings are used to store textual information.
* **Integer**: An integer data type represents whole numbers, both positive and negative, *without floating points*.
* **Float**: A float data type represents decimal numbers. Unlike integers, floats can have fractional parts. They are used for calculations involving real numbers.
* **Nested**: The "Nested" type typically refers to nested or embedded structures within a data model. Unlike Dict it has a defined schema.
* **Array**: An array is a collection of elements of the same data type, ordered by an index. These are used to store multiple values in a single key.
* **Dict**: A dictionary is a collection of key-value pairs. This is different from Nested, as a Dict is a open ended object and can accept any sub fields, whereas Nested has a defined schema.

{% hint style="info" %}
Some model types have restrictions of types of properties you can use. For for more information, [<mark style="color:blue;">**please check here**</mark>](/resources/models.md).
{% endhint %}
