Back to top

ReQL command: uuid

Command syntax

r.uuid([string]) → string


Return a UUID (universally unique identifier), a string that can be used as a unique ID. If a string is passed to uuid as an argument, the UUID will be deterministic, derived from the string’s SHA-1 hash.

RethinkDB’s UUIDs are standards-compliant. Without the optional argument, a version 4 random UUID will be generated; with that argument, a version 5 UUID will be generated, using a fixed namespace UUID of 91461c99-f89d-49d2-af96-d8e2e14e9b58. For more information, read Wikipedia’s UUID article.

Example: Generate a UUID.

> r.uuid().run(conn, callback)
// result returned to callback

Example: Generate a UUID based on a string.

> r.uuid("").run(conn, callback)
// Result passed to callback

Get more help

Couldn't find what you were looking for?