We value your privacy

This site uses cookies to improve your browsing experience, analyze site traffic, and show personalized content. See our Privacy Policy.

  1. MooseStack
  2. Data Types
  3. Nested Types

Nested Types

Nested types allow embedding complex objects within table rows. Nested types store each field as a separate array column, which can impact query performance for high-throughput paths. Consider Named Tuples for simpler structures stored inline.

Usage

Define a separate model and use it as a field type.

interface Address {  street: string;  city: string;  zip: string;  country: string;} interface User {  name: string;  email: string;  address: Address;    // Nested type}

Multiple Levels

Nested types can contain other nested types.

interface Coordinates {  lat: number;  lng: number;} interface Address {  street: string;  city: string;  location: Coordinates;    // Nested within nested} interface User {  name: string;  address: Address;}
Nested vs JSON

Use nested types when the structure is known and fixed. Use JSON for dynamic or variable structures.

See Also

  • Tuples — Lightweight inline structured data
  • JSON — Dynamic or semi-structured data
  • ClickHouse Nested — ClickHouse official documentation

On this page

UsageMultiple LevelsSee Also
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackHostingTemplatesGuides
Release Notes
Source531
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Language Server
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Dev
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
    • Strings
    • LowCardinality
    • Integers
    • Floats
    • Decimals
    • Booleans
    • Date & Time
    • Network
    • Arrays
    • Maps
    • Nested
    • Tuples
    • Enums
    • Geometry
    • JSON
    • Nullable
    • Aggregates
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework
interface Address {  street: string;  city: string;  zip: string;  country: string;} interface User {  name: string;  email: string;  address: Address;    // Nested type}
interface Coordinates {  lat: number;  lng: number;} interface Address {  street: string;  city: string;  location: Coordinates;    // Nested within nested} interface User {  name: string;  address: Address;}