Skip to content

Commit

Permalink
Bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhghomon committed Dec 20, 2024
1 parent 35d04c4 commit ba865e6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/content/doc-surrealdb/reference-guide/graph_relations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,27 @@ For further details on this pattern, see [this section](/docs/surrealql/statemen

### Traverse directly from a record instead of using SELECT

As graph traversal takes place between records, the same syntax can be used directly from one or more record IDs without needing to use a `SELECT` statement.

```surql
CREATE ONLY user:mcuserson SET name = "User McUserson";
CREATE ONLY comment:one SET
text = "I learned something new!",
created_at = time::now();
CREATE ONLY cat:pumpkin SET name = "Pumpkin";
RELATE user:mcuserson->wrote->comment:one SET
location = "Arizona",
os = "Windows 11",
mood = "happy";
RELATE user:mcuserson->likes->cat:pumpkin;
```

```surql
comment:one<-wrote<-user;
user:mcuserson->likes->cat;
```

### Graph paths in schemas

Expand Down

0 comments on commit ba865e6

Please sign in to comment.