Skip to content

Commit

Permalink
More content
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhghomon committed Jan 3, 2025
1 parent c226b16 commit 75de1c9
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/content/doc-surrealql/datamodel/idioms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1368,19 +1368,53 @@ person:you
]
```

As these three use their own algorithms to follow a path, any attempt to construct your own path using `.@` will result in an error.
As these three methods use their own algorithms to follow a path, any attempt to construct your own path using `.@` will result in an error. For example, choosing `+path` along with a field `connections: ->knows->person.@` will return an error because `+path` on its own will use its own recursive planner to output every possible path as an array of arrays, while `->knowns->person.@` is an instruction to put together arrays of each record and the next result from the `->knows->person` path at any possible depth.

```surql
person:1.{..+path}.{
person:you.{..+path}.{
id,
next: ->knows->person.@
connections: ->knows->person.@
};
```

```surql
'Can not construct a recursion plan when an instruction is provided'
```

Here is the output of both of these queries at a single depth to show the difference in output.

```surql
person:you.{..1}.{
id,
connections: ->knows->person.@
};
person:you.{..1+path}->knows->person;
```

```surql title="Output"
-------- Query --------
{
connections: [
person:friend2,
person:friend1
],
id: person:you
}
-------- Query --------
[
[
person:friend2
],
[
person:friend1
]
]
```

## Combining Idiom Parts

Idioms can combine multiple parts to navigate complex data structures seamlessly.
Expand Down

0 comments on commit 75de1c9

Please sign in to comment.