Empty list on a Query

I have a new schema entry (uploaded and checked in UI):

findPlayersByRankingId (rankingid: String!): [Player!]! @resolver(name: "find_players_by_ranking_id")

an index:

{
  name: "findPlayersByRankingId",
  unique: false,
  serialized: true,
  source: "Player",
  terms: [
    {
      field: ["data", "rankingid"]
    }
  ]
}

a function:

{
  name: "find_players_by_ranking_id",
  role: null,
  body: Query(
    Lambda(
      ["rankingid"],
      Select(
        "data",
        Map(
          Paginate(Match(Index("allPlayers"))),
          Lambda("x", Select("rankingid", Var("rankingid")))
        )
      )
    )
  )
}

2 records in the Players collection:

{  "ref": Ref(Collection("Player"), "281676817764450821"),  "ts": 1604886796740000,  "data": {    "rankingid": "280892229782864389",    "uid": "280684638795465228",    "rank": 1,    "challengerid": ""  }}

{  "ref": Ref(Collection("Player"), "281705989189665287"),  "ts": 1604914616690000,  "data": {    "rankingid": "280892229782864389",    "uid": "280689785097421325",    "rank": 2,    "challengerid": ""  }}

and the following Query in PG:

query FindPlayersByRankingById {
findPlayersByRankingId (
rankingid: "280892229782864389")
{
_id
rankingid
uid
rank
challengerid
}
}

Why do I get an empty list as a result:

{
  "data": {
    "findPlayersByRankingId": []
  }
}

in PG? thanks …

Hi @FreeRoss

the function is wrong:

  {
  name: "find_players_by_ranking_id",
  role: null,
  body: Query(
    Lambda(
      ["rankingid"],
      Select(
        "data",
        Map(
          Paginate(Match(Index("findPlayersByRankingId"), Var('rankingid'))),
          Lambda("x", Get(Var("x")))
        )
      )
    )
  )
}
)
query FindPlayersByRankingById {
	findPlayersByRankingId (rankingid: "280892229782864389")
	{
		_id
		rankingid
		uid
		rank
		challengerid
	}
}

returns:

{
  "data": {
    "findPlayersByRankingId": [
      {
        "_id": "281824612586619397",
        "rankingid": "280892229782864389",
        "uid": "280684638795465228",
        "rank": 1,
        "challengerid": ""
      },
      {
        "_id": "281824629773828613",
        "rankingid": "280892229782864389",
        "uid": "280689785097421325",
        "rank": 2,
        "challengerid": ""
      }
    ]
  }
}

Luigi

1 Like