Working with Data in NoSQL

The data units in NoSQL are referred to as Items, wherein each data item is similar to a record or row in a relational database, as described in this Terminology. Catalyst enables you to perform CRUD operations on your NoSQL tables using the server-side SDKs of Java, Node.js, or Python and through API.

Note: You can also perform CRUD operations from the Catalyst console to test working with data in NoSQL. However, you will only be able to add one item in a table from the console.

Catalyst supports the key-value pair based document-type data storage with the ability to add data in the Catalyst Custom JSON format, which is explained in the next section.

Note: You can add data in the regular JSON format that follows the International standard syntax from the Catalyst console alone to test. However, when working with the SDKs and API, you will only be able to add data in the Custom JSON format.

Catalyst also enables you to use multiple data types in the JSON data, that you can configure NoSQL attributes with. You can declare the right data type for an attribute while adding or updating data in the table.


Supported Data Types

The data types supported in Catalyst for NoSQL attributes are listed below.


Data Type Notation Description
String S Stores a sequence of characters
Number N Stores a numerical value
Binary B Stores a binary number that represents a sequence of bytes
Boolean BOOL Stores one of these boolean values: true or false
Set of String SS A set that stores one or more unique strings
Set of Numbers SN A set that stores a collection of numbers
Set of Binary SB A set that stores a collection of binary numbers as a byte set
List L Stores ordered elements of the same data type
Map M Stores an unordered collection of key-value pair elements
Null NULL Stores only one value: NULL

To understand the notations and usage of these data types while adding data in NoSQL, refer to the Catalyst Custom JSON format section.

Note:
  • When you configure a table or an index in NoSQL from the console, Catalyst allows you to only select one of the two data types, String or Number, for the primary keys of the table. This includes the partition key, sort key, and additional sort keys.

  • While adding or updating data in your NoSQL table, you must ensure that always you add the appropriate value for an attribute that matches the data type that you declare for it. Any mismatches between the data types and values will throw errors.


The Catalyst Custom JSON Format

The Catalyst Custom JSON is the format of JSON data that Catalyst can process for NoSQL. The syntax is similar to the standard JSON Format with the addition of specifying the data type that each attribute is configured with.

Let’s look at a sample table to understand the Catalyst Custom JSON format.

Sample Table Representation

Table Name- Employees

    
copy
{ "item": { "EmpID": { "N": "10999" }, "FirstName":{ "S": "Paul" }, "LastName":{ "S": "Smith" }, "YearOfJoining":{ "N": 2011 }, "PriorExperience":{ "BOOL": false }, "Location": { "M": { "Country": { "S": "USA" }, "City": { "S": "New York" } } } }, "item": { "EmpID": { "N": "10113" }, "FirstName":{ "S": "Lana" }, "LastName":{ "S": "Belle" }, "YearOfJoining":{ "N": 2019 }, "PriorExperience":{ "BOOL": true }, "Department": { "S": "IT" } }, "item": { "EmpID": { "N": "29123" }, "FirstName":{ "S": "Kevin" }, "LastName":{ "S": "Wilson" }, "YearOfJoining":{ "N": 2023 }, "Clubs":{ "L": [ { "S": "Innovate" }, { "S": "Swimmers of NPY" }, { "S": "Technova" } ] } } }

The Employees table includes nested JSON properties under the Location attribute, as well as an attribute, Clubs, with array values. In this table, each attribute is denoted with the data type configured for it, such as N (Number) for EmpI and YearOfJoining, or S for FirstName and LastName. The boolean attribute PriorExperience is denoted as BOOL.

Refer to the Supported Data Types section for all data types and their notations that you can use.

Important Points to Remember:

  • The primary keys of the table- the partition key and the sort keys, must be present in the root while constructing an item for adding or updating data in a table. The format shown here is only a representation. The formats for constructing data in each server-side SDK in this JSON format varies.

  • You can add or update data for your NoSQL table from the Catalyst console in either the standard JSON Format or the Catalyst Custom JSON Format to test.

  • You can only add or update data in your NoSQL table through the server-specific SDK of Java, Node.js, or Python, or through API, in the Catalyst Custom JSON format. The SDK help resources contain the formats and examples of constructing data items and inserting them in that programming environment.

  • If you use the standard JSON format while adding or updating data from the console, the data types associated with the primary key attributes while creating the table or index will be processed automatically. For all other attributes, their data types are recognized automatically by Catalyst based on the values you provide.

Last Updated 2025-05-30 16:54:59 +0530 +0530