JSON Tables

Documents are stored in JSON tables, which are tables in which every row is an OJAI document.

Each row is part of one column family (although you can create more, as described in Column Families). The value in the row is an OJAI document that is stored in a binary format. This format makes a number of optimizations to the document’s layout to make data access fast and efficient.

The OJAI documents that are in a table do not all have to have identical structures. It is possible to include in a single table any number of OJAI documents that have no common fields or that share a subset of fields.

For example, an online retailer might have documents such as these three documents in a single JSON table:

{
    "_id" : "4GGC859",
    "product_ID" : "4GGC859",
    "name" : "Thresher 1000",
    "brand" : "Careen",
    "category" : "Bicycle",
    "type" : "Road bicycle",
    "price" : 2949.99,

    "specifications" : {
        "size" : "55cm",
        "wheel_size" : "700c",
        "frameset" : {
            "frame" : "Carbon Enduro",
            "fork" : "Gabel 2"
         },
        "groupset" : {
            "chainset" : "Kette 230",
            "brake" : "Bremse FullStop"
	    },
        "wheelset" : {
	        "wheels" : "Rad Schnell 10",
	        "tyres" : "Reifen Pro"
        }
    }
}
{
    "_id" : "2DT3201",
    "product_ID" : "2DT3201",
    "name" : " Allegro SPD-SL 6800",
    "brand" : "Careen",
    "category" : "Pedals",
    "type" : "Components,
    "price" : 112.99,

    "features" : [
        "Low-profile design",
        "Floating SH11 cleats included"
    ],

    "specifications" : {
        "weight_per_pair" : "260g",
        "color" : "black"
    }
}
{
    "_id" : "3ML6758",
    "product_ID" : "3ML6758",
    "name" : "Trikot 24-LK",
    "brand" : "Careen",
    "category" : "Jersey",
    "type" : "Clothing",
    "price" : 76.99,

    "features" : [
        "Wicks away moisture.",
        "SPF-30",
        "Reflects light at night."
    ],

    "specifications" : {
        "sizes" : ["S","M","L","XL","XXL"],
        "colors" : [
            "white",
            "navy",
            "green"
        ]
     }
}

Only a subset of fields is common to all three documents. Each document has a different nested document in a field named specifications. Only two of the documents have arrays in the field features.