byId()

Get a document by its document ID.

Signature

byId(id: id): <Document> | Null<Document>

Description

Gets a document in the collection by its document ID.

Returns the document if it exists and is accessible. Otherwise, returns null.

Parameters

Parameter Type Required Description

id

String

Yes

ID of the document to get.

Return value

One of:

Type Description

Document

Document objects.

Null<Document>

Document doesn’t exist or is inaccessible. See NullDoc.

Examples

Letter.byId("357101842659803169")
{
  id: "357101842659803169",
  coll: Letter,
  ts: Time("2023-02-19T14:41:45.693Z"),
  name: "B"
}

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!