What version of Dgraph are you using?
v21.03.0-92-g0c9f60156
Have you tried reproducing the issue with the latest release?
yes
What is the hardware spec (RAM, OS)?
Dgraph Cloud
Steps to reproduce the issue
Add a user and add GameScores related to that user
Schema
type User {
id: ID!
username: String! @id @search(by: [fulltext])
scores: [GameScore]! @hasInverse(field: "user")
high_score: GameScore @lambda
}
type GameScore {
user: User!
record_date: DateTime!
score: Int!
}
Lambda:
const generateHighScore = (parent) => {
console.log(parent);
}
self.addGraphQLResolvers({
"User.high_score": generateHighScore
})
Expected behaviour and actual result.
Expected log of parent :
{ id: "0xExample", userName: "exampleName", scores: [ ] }
Actual log of parent :
{ id: "0xExample", userName: "exampleName" }
The goal was to make a simple Lambda that produced the high score from the score nodes connected to a given user. Every user is initialized with an empty array as the “scores” field. This field does not show up in the parent object when calling the lambda.