Confusion on the interactive tour https://dgraph.io/tour/blocksvars/11/

“Write a query to find the most recently released movie by each director and order the result by the release dates.”

I’m confused on the second query, in func: uid(maxDate).
After the first query, won’t maxDate be a mapping of the date of each director’s latest film? Don’t know how they manage to extract a uid out of a date

Hey @gorillastanley

Every variable also has the information of the UID. So in order to extract the value from it use val(variable) and to extract UID uid(variable) can be used.

1 Like

Thanks, just read the docs:

Value variables store scalar values. Value variables are a map from the UIDs of the enclosing block to the corresponding values.
Cheers!

1 Like