Using the modern graph, how can I write a query that finds the name of the oldest person?
I want to take the graph produced by TinkerFactory.createModern() and write a query that finds the oldest person and returns their name. I want to learn to use the max() traversal step.
4 Replies
I'm not sure I'd use
max()
in that case. It would be more like:
i guess you might have a case for max()
if it was more a traversal like:
OK thank you!
For this specific case you would typically use an
order...by
approach. The tricky part with max
is that it is a reducing barrier step, once you use it all traversers that had been exploring the graph are flattened into one.
So in this specifc case you typically would not use max
but would do something like
If you really wanted to use max
you need to do something like this
For some reason Discord did not show me Stephen's answers until just now - sorry for duplicate answer!
I guess it's good we both said the same thing 🙂Thanks Kelvin and Stephen!