in Exercise : Latest Movies | Blocksvars | Dgraph Tour,
{
directorids as var(func: has(director.film)) {
director.film {
initdate as initial_release_date
}
recently_release as max(val(initdate))
directorname as name@.
}
hello(func: uid(directorids), orderdesc: val(recently_release)) @cascade{
director_name : val(directorname)
recently_release_date : val(recently_release)
directorfilm : director.film @filter(eq(initial_release_date, val(recently_release) )) {
name@.
initial_release_date
}
}
}
i want to display the latest/most-recently movie of the director in the block
directorfilm : director.film @filter(eq(initial_release_date, val(recently_release) )) {
name@.
initial_release_date
}
however, the result display all of the movie information under that director like…
{
"data": {
"hello": [
{
"director_name": "James Cameron",
"recently_release_date": "2017-12-01T00:00:00Z",
"directorfilm": [
{
"name@.": "Piranha II: The Spawning",
"initial_release_date": "1981-12-01T00:00:00Z"
},
{
"name@.": "T2 3-D:Battle Across Time",
"initial_release_date": "1996-01-01T00:00:00Z"
},
{
"name@.": "Avatar 3",
"initial_release_date": "2017-12-01T00:00:00Z"
},
{
"name@.": "Avatar",
"initial_release_date": "2009-12-10T00:00:00Z"
},
{
"name@.": "Expedition: Bismarck",
"initial_release_date": "2002-12-08T00:00:00Z"
},
{
"name@.": "The Terminator",
"initial_release_date": "1984-10-26T00:00:00Z"
}
]
},
{
"director_name": "Espen Sandberg",
"recently_release_date": "2017-07-06T00:00:00Z",
"directorfilm": [
{
"name@.": "Max Manus: Man of War",
"initial_release_date": "2008-12-19T00:00:00Z"
},
{
"name@.": "Pirates of the Caribbean: Dead Men Tell No Tales",
"initial_release_date": "2017-07-06T00:00:00Z"
}
]
},
....
why is that?