Payload CMS icon

Payload CMS

Interact with Payload CMS collections and globals

Collection → Find by ID

AI-generated

Summary

Find a document by ID in a collection

Inputs

  • collection (required) — The collection to query
  • documentId (required) — The ID of the document to retrieve
  • additionalOptions — Optional query and file handling settings such as depth, limit, where clause, etc.

Output shape

single document

The operation returns the matching document; if not found the node may throw an error or pass an empty result depending on continueOnFail setting.

Examples

Example 1: Retrieve a post by its ID

collection: posts, documentId: 123, additionalOptions: {}

Example 2: Fetch a user with locale and select specific fields

collection: users, documentId: "user_456", additionalOptions: {"locale":"en","select":"name,email"}

Example 3: Upload a file while updating a document

collection: articles, documentId: 789, additionalOptions: {"upload":"file"}

Links

Discussion