Key document definition

The Key collection is a native collection, and its documents have an immutable, Fauna-defined structure. Moreover, the document structure returned at creation differs from the key document structure returned by a query of Key documents.

At creation, Fauna returns the key and a secret field. Subsequent queries of the key do not return the secret. Fauna Fauna cannot recover a secret that is discarded or lost. So, secure secrets with the same care and attention as any password.

Field name Value type Description

id

A unique identifier for a token. Fauna assigns this value at creation.

coll

Key

ts

Creation timestamp, with microsecond resolution and time zone.

name

A user-defined name.

role

Name of a user-defined role or one of the built-in roles (admin, server, server-readonly).

secret

The secret is a randomly generated cryptographic hash. This field is not stored in the document. The secret is only accessible in the Key.create() return. A caller obtains the secret from this return and stores it for subsequent queries. Fauna cannot recover a discarded or lost secret.

ttl

Timestamp indicating a key lifespan. When the ttl is reached, Fauna removes it. If ttl isn’t provided, this value is null, and the key persists indefinitely.

database

ref

Reference for the database associated with this key. When unavailable, the key is associated with the current database.

data

User-defined metadata for the key.

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!