Astra DB icon

Astra DB

Interact with DataStax Astra DB collections for document operations

Find One

AI-generated

Summary

Finds a single document in a specified collection within an Astra DB keyspace.

Inputs

  • keyspace (required) — The name of the Astra DB keyspace.
  • collection (required) — The name of the collection from which to find the document.
  • filter (required) — JSON filter criteria to locate the document.
  • options — Additional options for the search, such as sorting and projection.

Output shape

a single document object or null if not found

If no document matches the filter, the operation returns null.

Examples

Example 1: Finding a document with a specific ID

Set the keyspace, collection, and filter to match the document's ID.

Example 2: Finding documents with sorting

Add sorting options in the options field to retrieve the document in a specific order.

Discussion