Skip to content

Commit

Permalink
Clarify that :rand() is the default (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhghomon authored Dec 9, 2024
1 parent 472f3a4 commit 2b0183d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/content/doc-surrealql/datamodel/ids.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,18 @@ CREATE temperature:['London', $now] SET
```

### Generating Record IDs

Record IDs can be generated with a number of built-in ID generation functions. These allow for record IDs to be generated using cryptographically-secure randomly-generated identifiers (which are suitable for dispersion across a distributed datastore), sequentially incrementing `ULID` Record identifiers, and `UUID` version 7 Record idenfitifiers.

```surql
// Generate a random record ID
// Charset: `abcdefghijklmnopqrstuvwxyz0123456789`
// ID Length: 20 characters long
CREATE temperature SET time = time::now(), celsius = 37.5;
// :rand() is the default random ID format, so this
// is identical to the above CREATE statement
CREATE temperature:rand() SET time = time::now(), celsius = 37.5;
// Generate a ULID-based record ID
CREATE temperature:ulid() SET time = time::now(), celsius = 37.5;
// Generate a UUIDv7-based record ID
Expand Down

0 comments on commit 2b0183d

Please sign in to comment.