A reference to a Document or Named Document that could not be read. The Document may or may not exist in future queries. The cause field specifies the reason the document could not be read, typically because the Document does not exist or due to insufficient privileges.

Some read operations, such as the <Collection>.byId method may return either a Document or a NullDocument. This example shows how to handle such a result with the driver

 const response = await client.query<Document | NullDocument>(fql`
Users.byId("101")
`);
const maybeUserDocument = response.data;

if (maybeUserDocument instanceof NullDocument) {
// handle NullDocument case
const cause = maybeUserDocument.cause
} else {
// handle Document case
const color = maybeUserDocument.color;
}

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

Constructors

Properties

Constructors

Properties

cause: string