I have progressed with that change as I am able to retrieve a list of owner rankings with assoc data and a list of member rankings but with refs only.
My schema is now:
type User {
active: Boolean!
username: String!
description: String
email: String
mobile: String
ownerOf: [Ranking!]! @relation(name:"ownerranking")
memberOf: [Player!]! @relation(name: "playerinranking")
}
type Player {
active: Boolean!
rank: Int!
ranking: Ranking! @relation(name: "playerinranking")
playerInfo: User!
challenger: Player @relation (name: "playerchallenger")
}
type Ranking {
active: Boolean!
rankingname: String!
rankingdesc: String
owner: User! @relation(name:"ownerranking")
}
I will need to display the ranking names for member rankings at least, possibly descriptions, but just names for now.
Following your suggestion I get a list of players with member ranking refs:
Map(
Paginate(
Match(
Index("playerinranking_by_user"),
Ref(Collection("User"), "290125575057572353")
)
),
Lambda("player", Get(Var("player")))
)
However, I need to retrieve the ‘deeply nested’ rankingname. Following another suggestion, I used this as a referernce. User to member rankings is a one to many relationship so the closest example is:
Map(
Paginate(Match(Index('thing2sByThing1'), Var('instance'))),
(ref) =>
Let(
{
instance: Get(Var('ref'))
},
{
/* repeat above recursively */
/* `ref` and `instance` variables are scoped! */
}
)
),
Attempting to merge what I currently know about both queries I get:
Map(
Paginate(
Match(
Index("memberranking_by_user"), Var("instance"))), (ref)
Let(
{
instance: Get(Var('ref'))
}
)
)
which is obviously not correct because, at least, I haven’t supplied the User reference. However, ‘ref’ is used as a variable, so it cannot just be replaced with the reference for User I already have.
How do I need to change this nested query to retrieve rankingnames for all the rankings the user is a member of?
thanks again …