CDT example - Unsupported command format with token

Hi All,

Trying to get a simple CDT to work from aql

insert into insurance.t1 (PK,name,trips) values(17,"No Name", list('[0,1,[2,[3,4],5,6,[7,[8,9]]]]'))

 aql> select * from insurance.t1
+-------------+------------------------------------------------+
| name        | trips                                          |
+-------------+------------------------------------------------+
| "No Name" | LIST('[0, 1, [2, [3, 4], 5, 6, [7, [8, 9]]]]') |
+-------------+------------------------------------------------+

this works:

OPERATE LIST_APPEND("trips", 4) on insurance.t1 where PK=17

aql> select * from insurance.t1 where name="N Maharaj"
+-------------+---------------------------------------------------+
| name        | trips                                             |
+-------------+---------------------------------------------------+
| "No Name" | LIST('[0, 1, [2, [3, 4], 5, 6, [7, [8, 9]]], 4]') |
+-------------+---------------------------------------------------+

1 row in set (0.001 secs)

This doesn’t:

aql> operate list_append('trips', 99, context=[BY_LIST_INDEX(-1)] on insurance.t1 where PK=17
Unsupported command format with token -  'context'
Make sure string values are enclosed in quotes.
Type " aql --help " from console or simply "help" from within the aql-prompt.

Following docs:

https://docs.aerospike.com/docs/guide/cdt-context.html#append-an-item-to-a-list-at-the-last-element

https://docs.aerospike.com/docs/tools/aql/record_operations.html#operate-on-a-record

Does it only work with the APIs?

In Java I can see it here:

// Create ordered list at map's "key2" only if list does not exist.
		// Append 2,1 to ordered list.
		CTX ctx = CTX.mapKey(Value.get("key2"));
		Record record = client.operate(params.writePolicy, key,
			ListOperation.create(binName, ListOrder.ORDERED, false, ctx),
			ListOperation.append(binName, Value.get(2), ctx),
			ListOperation.append(binName, Value.get(1), ctx),
			Operation.get(binName)
			);

		record = client.get(params.policy, key);
		console.info("Record: " + record);

Would be nice to see the same in the aql cli

The guidance from the product team is to use the client APIs for CDT capabilities, and not depend on AQL. As you noted, AQL currently does not support nested CDT operations. There are no plans to add them to AQL.