Skip to content

Commit

Permalink
Mention that +shortest can also take a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhghomon committed Jan 7, 2025
1 parent a54d99c commit ae62e27
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/content/doc-surrealql/datamodel/idioms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ae62e27

Please sign in to comment.