Skip to content

Commit

Permalink
Expand some more on advantages to graph links
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhghomon committed Jan 7, 2025
1 parent b2d55a0 commit ed965ad
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ Record links are preferred if:

Graph links are preferred if:

* You want to create links without touching the database schema.
* You want to quickly create links without touching the database schema, or among multiple record types. For example, a single `RELATE person:one->wrote->[blog:one, book:one, comment:one]` is enough to create links between a `person` and three other record types, whereas using record links may be a more involved process involving several `DEFINE FIELD` statements.
* You want to put together complex queries that take advantage of SurrealQL's expressive arrow syntax, like `->wrote->comment<-wrote<-person->wrote->comment FROM person`.
* You want to visualize your schema using Surrealist's designer view.

Finally, graph links are not just preferred but almost certainly necessary if you need to keep metadata about the context in which a link is created. Take the following metadata for the examples above involving a user and its comments which contains information about a user's current location, operating system, and mood. Where does this data belong?

Expand Down

0 comments on commit ed965ad

Please sign in to comment.