Iterate Over Documents

async AsyncCogniteClient.documents.__call__(
chunk_size: int | None = None,
filter: Filter | dict[str, Any] | None = None,
sort: DocumentSort | SortableSourceFileProperty | SortableDocumentProperty | str | list[str] | tuple[SortableSourceFileProperty | SortableDocumentProperty | str | list[str], Literal['asc', 'desc']] | None = None,
limit: int | None = None,
) AsyncIterator[Document] | AsyncIterator[DocumentList]

Iterate over documents

Fetches documents as they are iterated over, so you keep a limited number of documents in memory.

Parameters:
  • chunk_size (int | None) – Number of documents to return in each chunk. Defaults to yielding one document at a time.

  • filter (Filter | dict[str, Any] | None) – The filter to narrow down the documents to return.

  • sort (DocumentSort | SortableProperty | tuple[SortableProperty, Literal['asc', 'desc']] | None) – The property to sort by. The default order is ascending.

  • limit (int | None) – Maximum number of documents to return. Default to return all items.

Yields:

Document | DocumentList – yields Documents one by one if chunk_size is not specified, else DocumentList objects.