GetAsync(TKey , RecordRetrieveOptions?, CancellationToken)

This method retrieves a single record from the vector store. It does not guarantee that the collection exists and returns null if the record is not found.

Declaration

// C#
public async Task<TRecord?> GetAsync(TKey key, RecordRetrieveOptions? options = null, CancellationToken cancellationToken = default);

Parameters

  • key

    The unique ID associated with the record to retrieve.

  • options

    Optional options for retrieving the records.

  • cancellationToken

    The cancellation token.

Return Value

Task<TRecord?> object representing the record if found, or null if not found.

Implements

Microsoft.Extensions.VectorData.VectorStoreCollection

Exceptions

VectorStoreException: The command fails to execute for any reason other than the absence of a record.