> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trychroma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Data

> Learn how to update and upsert data in Chroma collections.

Any property of records in a collection can be updated with `.update`:

<CodeGroup>
  ```python Python theme={null}
  collection.update(
      ids=["id1", "id2", "id3", ...],
      embeddings=[[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
      metadatas=[{"chapter": 3, "verse": 16}, {"chapter": 3, "verse": 5}, {"chapter": 29, "verse": 11}, ...],
      documents=["doc1", "doc2", "doc3", ...],
  )
  ```

  ```typescript TypeScript theme={null}
  await collection.update({
      ids: ["id1", "id2", "id3", ...],
      embeddings: [[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
      metadatas: [{"chapter": 3, "verse": 16}, {"chapter": 3, "verse": 5}, {"chapter": 29, "verse": 11}, ...],
      documents: ["doc1", "doc2", "doc3", ...]
  })
  ```

  ```rust Rust theme={null}
  collection.update(
      vec!["id1".to_string(), "id2".to_string(), "id3".to_string()],
      Some(vec![
          Some(vec![1.1, 2.3, 3.2]),
          Some(vec![4.5, 6.9, 4.4]),
          Some(vec![1.1, 2.3, 3.2]),
      ]),
      Some(vec![
          Some("doc1".to_string()),
          Some("doc2".to_string()),
          Some("doc3".to_string()),
      ]),
      None,
      None,
  ).await?;
  ```
</CodeGroup>

If an `id` is not found in the collection, an error will be logged and the update will be ignored. If `documents` are supplied without corresponding `embeddings`, the embeddings will be recomputed with the collection's embedding function.

Metadata values can include arrays — see [Adding Data](/docs/collections/add-data#metadata) for supported metadata types.

If the supplied `embeddings` are not the same dimension as the collection, an exception will be raised.

Chroma also supports an `upsert` operation, which updates existing items, or adds them if they don't yet exist.

<CodeGroup>
  ```python Python theme={null}
  collection.upsert(
      ids=["id1", "id2", "id3", ...],
      embeddings=[[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
      metadatas=[{"chapter": 3, "verse": 16}, {"chapter": 3, "verse": 5}, {"chapter": 29, "verse": 11}, ...],
      documents=["doc1", "doc2", "doc3", ...],
  )
  ```

  ```typescript TypeScript theme={null}
  await collection.upsert({
    ids: ["id1", "id2", "id3"],
    embeddings: [
      [1.1, 2.3, 3.2],
      [4.5, 6.9, 4.4],
      [1.1, 2.3, 3.2],
    ],
    metadatas: [
      { chapter: "3", verse: "16" },
      { chapter: "3", verse: "5" },
      { chapter: "29", verse: "11" },
    ],
    documents: ["doc1", "doc2", "doc3"],
  });
  ```

  ```rust Rust theme={null}
  collection.upsert(
      vec!["id1".to_string(), "id2".to_string(), "id3".to_string()],
      vec![
          vec![1.1, 2.3, 3.2],
          vec![4.5, 6.9, 4.4],
          vec![1.1, 2.3, 3.2],
      ],
      Some(vec![
          Some("doc1".to_string()),
          Some("doc2".to_string()),
          Some("doc3".to_string()),
      ]),
      None,
      None,
  ).await?;
  ```
</CodeGroup>

If an `id` is not present in the collection, the corresponding items will be created as per `add`. Items with existing `id`s will be updated as per `update`.
