I reviewed this approach and believe I don’t want the playerInfo field because the User relation with challenger can provide all the necessary data alone. Schema is now back to:
type User {
active: Boolean!
username: String!
description: String
email: String
mobile: String
playedAs: [Player!]! @relation
}
type Player {
active: Boolean!
rank: Int!
ranking: Ranking! @relation
challenger: User @relation
}
type Ranking {
active: Boolean!
rankingname: String!
rankingdesc: String
player: Player @relation
}
type Mutation {
createNewUser(active: Boolean!, username : String!, password : String!, description: String, email: String, mobile: String): loginResult! @resolver(name: "create_new_user")
loginUser(username: String!, password: String!): loginResult! @resolver(name: "login_user")
}
type Query {
allUserNames: [String!]! @resolver(name: "all_user_names")
allPlayerUIDs: [String!]! @resolver(name: "all_player_uids")
allPlayerRanks: [Int!]! @resolver(name: "all_player_ranks")
allPlayerChallengerUIDs: [String!]! @resolver(name: "all_player_challenger_uids")
allPlayers: [Player] @resolver(name: "all_players")
allRankings: [Ranking] @resolver(name: "all_rankings")
allUsers: [User] @resolver(name: "all_users")
gotPlayersByRankingId (rankingid: String!): [Player] @resolver(name: "got_players_byrankingid")
gotRankingIdsByPlayer (uid: String!): [String] @resolver(name: "got_rankings_byplayerid")
}
type loginResult @embedded
{
token : String
logginUser : User
}
and has been uploaded.
However, I created an index: players_by_member_ranking.
I have player doc:
{
"ref": Ref(Collection("Player"), "288025613763084801"),
"ts": 1610951808113000,
"data": {
"active": true,
"rank": 1,
"ranking": Ref(Collection("Ranking"), "282953512300577285"),
"challenger": Ref(Collection("User"), "283120055707763201")
}
}
When I query the Player collection by string ranking
“282953512300577285” I get:
No results found for the index "players_by_member_ranking"
This problem may be similar to a separate issue I posted in another thread.
Why are no results found if there is a ref to this ranking in the Player doc?
thanks …