About nested Map in a Map value still can be sorted by key

I use a nested map in another map 's value, but I found I can use outer map 's key to get range, I like this feature. :slight_smile:

import aerospike
from aerospike import predicates as p
config = { 'hosts': [ ("localhost", 3000), ] }
client = aerospike.client(config).connect()
client.map_set_policy(key, "mymap", map_policy)
key4 = ('DC', 'demo', 'km4')

# insert nested map
client.map_put(key4,  "mymap", 1, {'a': 'va1', 'b': 'vb1', 'c': 'vc1' })
client.map_put(key4,  "mymap", 2, {'a': 'va2', 'b': 'vb2', 'c': 'vc2' })
client.map_put(key4,  "mymap", 3, {'a': 'va3', 'b': 'vb3', 'c': 'vc3' })
client.map_put(key4,  "mymap", 4, {'a': 'va4', 'b': 'vb4', 'c': 'vc4' })

# can sorted by key 
ret_val = client.map_get_by_key_range(key4, "mymap", 0, 3, aerospike.MAP_RETURN_KEY_VALUE)
print ret_val
1 Like