Extracting hash map from Redis using Redis keys result to populate a table

I am trying to build the data processing to complete the following steps:

  1. users can select whether a "players" from a table belongs to Team A or Team B, the players are stored in Firebase
  2. I want to show what players are selected and to what team they belong

I don't want to store these steps in Firebase but rather in the Redis backend. My current approach is as follows:

  1. the user can select the team with an action that triggers a Redis query to write the hash map key with the following command hset teamComp:{{newGamePlayerSelect.selectedRow.data._id}} team "B" fullName "{{newGamePlayerSelect.selectedRow.data.full_name}}" photoUrl "{{newGamePlayerSelect.selectedRow.data.photo_url}}" profileName "{{newGamePlayerSelect.selectedRow.data.display_name}}"
  2. I extract the list of keys from redis with KEYS teamComp:*
  3. stuck I want to map over the returned values from 2 to retrieve all the details I stored in step 1.

For step 3, I tried to write the following javascript script:

function runQuery() {
  var result = [];
  var errors = "";
  var usersDetails = getTeamPlayers.data.map(function(x) {
    console.log("Try to run getTeamPlayerDetails for:" + x);
    
    getTeamPlayerDetails.trigger({
      additionalScope: {userId: x},
      onSuccess: function(data) {
        result.append(data);
      },
      onFailure: function (error) {
        // Update the Errors text
        errors += "Found error while processing " + x + ":  " + error + "\n\n";
        Errors.setValue(errors);
      },
    })
  });
  
  return result;
}

The query getTeamPlayerDetails details are the screenshots below.


Any help would be greatly appreciated.