A materialized Document with an ID. Keys, Tokens and Documents in user-defined Collections are modeled with a Document. All top level Document fields are added to a Document instance, but types cannot be provided. Cast the instance to a DocumentT to have typesafe access to all top level fields.

The example below retrieves a document from a hypothetical "Users" collection.

 const response = await client.query(fql`
Users.byId("101")
`);
const userDocument = response.data;

const color = userDocument.color;

The Document class cannot be generic because classes cannot extend generic type arguments.

https://docs.fauna.com/fauna/current/reference/fql_reference/types#special

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

coll: Module
id: string
ttl?: TimeStub

Methods