Map/List Operations


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}]}


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

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”.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.