Sorting of duplicates values in map

Hi, I have a map (leaderboard) where exists

{
    ["player1"] = 10, // updated last
    ["player3"] = 10, // updated second
    ["player2"] = 10, // updated first
    ["player4"] = 9, // updated third
}

run operaion: > MapOperation.GetByRankRange(_mapper.BinName, 0, apReturnType.KEY_VALUE);

and result is :

{
    ["player1"] = 10, // updated last
    ["player2"] = 10, // updated first
    ["player3"] = 10, // updated second
    ["player4"] = 9, // updated third
}

Looks like it sorted by by value after items with the same values sorted by name.

Is any way to keep order according update time for items with the same values expected:

{
    ["player2"] = 10, // updated first
    ["player3"] = 10, // updated second
    ["player1"] = 10, // updated last
    ["player4"] = 9, // updated third
}

Update time is not a state that is stored by map. You can do it with this data model: map = { [“playerName”] = [value, timestamp] }

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