Construct NoSQL Item
Catalyst NoSQL items represent a collection of attributes that hold the data of a single data point, like records. You can insert or update items into an existing NoSQL table in your project in a Custom JSON format. However, before you insert or update an item in Catalyst, you will need to construct the item.
You can construct a NoSQL item of attributes containing different data types supported by Catalyst as described in the section below. Catalyst supports several data types such as String, Number, Set of Strings, Set of Numbers, List, and Map. Refer to the full list of supported data types in the shared resource to learn more.
You must mandatorily provide the values for the partition key attribute that you configured for a table in every data item. Refer to Table Keys help section to learn about the table keys, TTL attribute, and other details.
Create a New NoSQL Item
You can create a new NoSQL item using the ZCNoSQLItem() method, as shown below.
copyZCNoSQLItem item = new ZCNoSQLItem();
Create a New NoSQL Item with JSON / Map
You can create a new NoSQL item from a plain JSON data or from a Map after you define them as shown below.
copy//public static ZCNoSQLItem fromJSON(String json) throws Exception; ZCNoSQLItem.fromJSON(<json string>);
Construct NoSQL Items of Different Data Types
The code snippet below shows the formats for constructing an item with attributes of different data types:
copy//public ZCNoSQLItem withString(String attrName, String val) throws Exception; item.withString("attribute name", "<string value>"); //public ZCNoSQLItem withNumber(String attrName, BigDecimal val) throws Exception; //public ZCNoSQLItem withNumber(String attrName, Number val) throws Exception; item.withNumber("attribute name", "<numeric value>"); //public ZCNoSQLItem withInt(String attrName, int val) throws Exception; item.withInt("attribute name", "<integer value>"); //public ZCNoSQLItem withBigInteger(String attrName, BigInteger val) throws Exception; item.withBigInteger("attribute name", "<BigInt value>"); //public ZCNoSQLItem withShort(String attrName, short val) throws Exception; item.withShort("attribute name", "<Short value>"); //public ZCNoSQLItem withFloat(String attrName, float val) throws Exception; item.withFloat("attribute name", "<Float value>"); //public ZCNoSQLItem withDouble(String attrName, double val) throws Exception; item.withDouble("attribute name", "<Double value>"); //public ZCNoSQLItem withLong(String attrName, long val) throws Exception; item.withLong("attribute name", "<Long value>"); //public ZCNoSQLItem withBinary(String attrName, byte[] val) throws Exception; //public ZCNoSQLItem withBinary(String attrName, ByteBuffer val) throws Exception; item.withBinary("attribute name", "<Byte value>"); //public ZCNoSQLItem withStringSet(String attrName, Set<String> val) throws Exception; //public ZCNoSQLItem withStringSet(String attrName, String... val) throws Exception; item.withStringSet("attribute name", "<StringSet/String variadic param value>"); //public ZCNoSQLItem withBigDecimalSet(String attrName, Set<BigDecimal> val) throws Exception; //public ZCNoSQLItem withBigDecimalSet(String attrName, BigDecimal... vals) throws Exception; item.withBigDecimalSet("attribute name", "<DecimalSet/Decimal Variadic param value>"); //public <T extends Number> ZCNoSQLItem withNumberSet(String attrName, T... vals) throws Exception; //public <T extends Number> ZCNoSQLItem withNumberSet(String attrName, Set<T> vals) throws Exception; item.withNumberSet("attribute name", "<Numeric/Numeric Variadic param value>"); //public ZCNoSQLItem withBinarySet(String attrName, Set<byte[]> val) throws Exception; //public ZCNoSQLItem withBinarySet(String attrName, byte[]... vals) throws Exception; //public ZCNoSQLItem withBinarySet(String attrName, ByteBuffer... vals) throws Exception; item.withBinarySet("attribute name", "<Byte Set value>"); //public ZCNoSQLItem withByteBufferSet(String attrName, Set<ByteBuffer> val) throws Exception; item.withByteBufferSet("attribute name", "<Byte Set value>"); //public ZCNoSQLItem withList(String attrName, List<?> val) throws Exception; //public ZCNoSQLItem withList(String attrName, Object... vals) throws Exception; item.withList("attribute name", "<List/Variadic Param value>"); //public ZCNoSQLItem withMap(String attrName, Map<String, ?> val) throws Exception; item.withMap("attribute name", "<Map value>"); //public ZCNoSQLItem withJSON(String attrName, String json) throws Exception; item.withJSON("attribute name", "<JSON String value>"); //public ZCNoSQLItem withBoolean(String attrName, boolean val) throws Exception; item.withBoolean("attribute name", "<Boolean value>"); //public ZCNoSQLItem withNull(String attrName) throws Exception; item.withNull("attribute name"); //public ZCNoSQLItem with(String attrName, Object val) throws Exception; item.with("attribute name", "<Value>");
Last Updated 2025-06-20 16:21:48 +0530 +0530
Yes
No
Send your feedback to us