Map/List Operations

Hey,

I have a question related to the Map/List operation. My storage in my app is looking like that: 1.Each Record has one Bin which is Ordered KEY_VALUE Map. 2.Each key in the Map is pointing to a List of 3 elements. [Long,Map,Long].

One Bin For example: { “someKey” : [121341241, {“luv”: “1”}, 424535353], “name”: [324242442, {“st”:333, “dt”: “test”}, 45563646] … }

My question is: It is possible to add or set new attribute in the internal Map located in the List ? and if not, what is the best approach in this case? udf?

Thanks :slight_smile:

Actually, I was able to do that. My question now is if it’s possible to update the Long values in the list.

Meaning, update the first element in the list which is the value of a map.

I’m unsure if I understand. Could you show the object translation you are trying to achieve?

For example are you trying to translate from:

{ 1: [2, {k:v}]}

To:

{ 1: [3, {k:v}]}

https://www.aerospike.com/docs/guide/cdt-context.html

You could do the following:

ctx = [BY_MAP_KEY, "someKey", BY_INDEX, 0]
LIST_SET(context=ctx, index=0, value=YourValue)

This would update the first element of the list for “someKey”.

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.