diff --git a/src/content/doc-surrealql/datamodel/idioms.mdx b/src/content/doc-surrealql/datamodel/idioms.mdx index 4f16341d5..c1636e95f 100644 --- a/src/content/doc-surrealql/datamodel/idioms.mdx +++ b/src/content/doc-surrealql/datamodel/idioms.mdx @@ -1277,6 +1277,14 @@ person:you.{..+shortest=person:star}->knows->person; ] ``` +The part after `+shortest` can also take a parameter if it is a record ID. The following example will return the same result as the previous one. + +```surql +LET $you = SELECT VALUE id FROM ONLY person WHERE name = 'you' LIMIT 1; +LET $star = SELECT VALUE id FROM ONLY person WHERE name = 'star' LIMIT 1; +$you.{..+shortest=$star}->knows->person; +``` + #### +collect Using `+collect` will collect all of the unique collected records. As this collection is created by moving recursively one level at a time, the output will show the closest connections first and least close connections at the end.