Cosmocloud Build Documentation
DocumentationTutorials
  • Welcome to Cosmocloud
  • Getting Started
    • 1. Organisations
    • 2. Projects
    • 3. Connect your Database
    • 4. Create Database Models
    • 5. Create APIs
    • 6. Testing Free Tier APIs
  • Free Tier
    • Connecting with MongoDB Data APIs
  • Templates
    • CRUD APIs
    • Entity Search APIs
    • Fetch / Upload Media APIs
  • Examples - How To?
    • Making an external API call
    • Reusable Flows - SubFlows
    • Creating Custom Error Responses
    • Flow Builder - Building Conditional Logics
    • Flow Builder - Utilising Loops
    • Creating Dynamic Queries
    • Accessing Auth Tokens in APIs
    • How to upload/download media in Object Storage
  • Resources
    • APIs
      • Checking Logs
    • SubFlows
    • Models
      • Building Models
    • Environments
      • Environment Tier Types
    • Secrets
      • Custom Secrets
    • Databases
    • Releases
    • Vector Search
      • Create a Vector Search Index
      • Edit a Vector Search Index
      • Delete a Vector Search Index
    • Document Search
      • Full Text Search
        • Concepts
          • Indexing in full-text search
          • Data processing using Analyzers
        • Create a Search Index
        • Creating a Custom Analyzer
        • Full Text Search FAQ
      • Vector Search
    • Object Storage
  • Flow Builder
    • Node Types
      • Trigger Nodes
        • HTTP Response
      • Conditional Nodes
        • If Else
        • If Else V2
        • Switch Case
      • Crypto Nodes
        • PBKDF2 Hmac Hash
      • Debug Node
      • Database Nodes
        • Delete One
        • Delete Many
        • Fetch By ID
        • Find One
        • Find Many
        • Insert One
        • Insert Many
        • List Records
        • Run Aggregation Pipeline
        • Update One
        • Update by ID
        • Update Many
      • External Nodes
        • Fire Events (SQS)
        • API Call
        • Delete storage objects
        • Execute SubFlow
        • Get Presigned URL
        • Post Presigned URL
        • Send EMAIL (SES)
        • Send SMS (SNS)
      • Loop Nodes
        • For loop
        • While loop
      • Variable Nodes
        • Arrays
          • Append array
          • Contains
          • Check array empty
          • Extend array
          • Get Array Item
          • Length of array
          • Reverse array
          • Sort array
        • Date and Time
          • Set current datetime
        • Strings
          • Append String
          • Concat Strings
          • Convert to String
          • Length of String
          • Slice String
          • Split String
          • String Operations
          • To Lower
          • To Upper
          • Trim String
        • Mathematical
          • Add Variable
          • Complex Math Expr
          • Decrement Variable
          • Divide Variable
          • Increment Variable
          • Multiply Variable
          • Subtract Variable
        • JSON
          • Build JSON Object
          • Merge JSON Objects
          • Object to String
          • Update JSON Object
        • Special
          • Build Map
          • Set Variable
          • Exists Check
    • Node name
    • CQL - Cosmocloud Query Language
      • Building Expressions
        • $abs
        • $add
        • $addDate
        • $arrayElemAt
        • $avg
        • $buildDateTime
        • $buildMap
        • $ceil
        • $cond
        • $divide
        • $floor
        • $getDay
        • $getHour
        • $getMinute
        • $getMonth
        • $getSecond
        • $getYear
        • $ifNull
        • $max
        • $min
        • $mod
        • $multiply
        • $pow
        • $subtract
        • $sqrt
      • Building Conditions
        • Compound Operators
          • $and
          • $or
        • Conditional Operators
          • $eq
          • $gt
          • $gte
          • $lt
          • $lte
          • $neq
      • Magical Autocomplete
  • Advanced Guide
    • Configuring Authentication
      • SSO Providers
        • AWS Cognito
      • Authentication Concepts
    • MongoDB Query Language
      • Limitations
    • Performance Considerations
      • Instant Deployments
  • User Management
  • Billing and Payments
    • Billing Portal
  • Help & Support
  • References
    • Change log
    • Available Cloud & Regions
Powered by GitBook
On this page
  • Understanding requirements
  • Supported data types in schema builder
  1. Resources
  2. Models

Building Models

Understanding requirements

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

{
    "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 :

  1. Navigate to Models screen from Application Layer -> Models.

  2. After model is created navigate to Schema tab on top of model details page.

  3. You can now start building your model's schema.

Models schema for above requirements would appear something like this :

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.

PreviousModelsNextEnvironments

Last updated 1 year ago

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 .

Some model types have restrictions of types of properties you can use. For for more information, .

model types here
please check here
model schema