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

# Update data

> Update existing documents in a LambdaDB collection by ID. Modify specific fields without replacing the entire document using SDK or REST API calls.

This page shows you how to update documents in a collection.

<Note>
  If the collection contains managed embedding vector fields, update the configured source text fields instead of sending direct vector values for managed embedding fields.
</Note>

<CodeGroup>
  ```python Python theme={null}
  from lambdadb import LambdaDB

  with LambdaDB(
      project_api_key="YOUR_API_KEY",
      base_url="YOUR_BASE_URL",
      project_name="YOUR_PROJECT_NAME",
  ) as client:
      coll = client.collection("my_collection")
      docs = [
          {"id": "33201222", "title": "LambdaDB", "text": "LambdaDB is an AI-native database ... "},
          {"id": "33201223", "url": "https://en.wikipedia.org/wiki/Winamp", "title": "Winamp v2", "text": "Winamp v2 is a media player for Windows, macOS and Android, originally developed by Nullsoft."},
      ]
      coll.docs.update(docs=docs)
  ```

  <Note>
    Python: `LambdaDB` supports context manager usage. `__enter__` returns the client, and `__exit__` calls `client.close()` (closing the SDK-owned HTTP client) and makes the client unusable after the `with` block. If you don't use `with`, call `client.close()` when you're done. If you pass a custom `client=`/`async_client=`, you own closing it.
  </Note>

  ```typescript TypeScript theme={null}
  import { LambdaDBClient } from "@functional-systems/lambdadb";

  const client = new LambdaDBClient({
    projectApiKey: "YOUR_API_KEY",
    baseUrl: "YOUR_BASE_URL",
    projectName: "YOUR_PROJECT_NAME",
  });
  await client.collection("my_collection").docs.update({
    docs: [
      { id: "33201222", title: "LambdaDB", text: "LambdaDB is an AI-native database ... " },
      { id: "33201223", url: "https://en.wikipedia.org/wiki/Winamp", title: "Winamp v2", text: "Winamp v2 is a media player for Windows, macOS and Android." },
    ],
  });
  ```

  ```go Go theme={null}
  package main

  import (
    "context"
    "log"
    lambdadb "github.com/lambdadb/go-lambdadb"
  )

  func main() {
    ctx := context.Background()
    client := lambdadb.New(
      lambdadb.WithBaseURL("YOUR_BASE_URL"),
      lambdadb.WithProjectName("YOUR_PROJECT_NAME"),
      lambdadb.WithAPIKey("YOUR_API_KEY"),
    )
    docs := []map[string]interface{}{
      {"id": "33201222", "title": "LambdaDB", "text": "LambdaDB is an AI-native database ... "},
      {"id": "33201223", "title": "Winamp v2", "text": "Winamp v2 is a media player for Windows, macOS and Android."},
    }
    _, err := client.Collection("my_collection").Docs().Update(ctx, lambdadb.UpdateDocsInput{Docs: docs})
    if err != nil {
      log.Fatal(err)
    }
  }
  ```

  ```bash cURL theme={null}
  LAMBDADB_PROJECT_API_KEY="YOUR_API_KEY"

  curl -X POST \
    "$BASE_URL/projects/$PROJECT_NAME/collections/{collectionName}/docs/update" \
    -H 'content-type: application/json' \
    -H 'x-api-key: $LAMBDADB_PROJECT_API_KEY' \
    -d '{
      "docs": [
        {
          "id": "33201222",
          "title": "LambdaDB",
          "text": "LambdaDB is an AI-native database ... "
        },
        {
          "id": "33201223",
          "url": "https://en.wikipedia.org/wiki/Winamp",
          "title": "Winamp v2",
          "text": "Winamp v2 is a media player for Windows, macOS and Android, originally developed by Justin Frankel and Dmitry Boldyrev by their company Nullsoft, which they later sold to AOL, who sold to Radionomy in January 2014."
        }
      ]
    }'
  ```
</CodeGroup>

<Info>
  Each document in a payload must contain an `id` field to uniquely identify a document to update.
  For a partitioned collection, a document in the `__default__` partition with a matching `id` value is updated if the partition field is not provided.
</Info>

## Update limits

| Metric                       | Limit          |
| :--------------------------- | :------------- |
| Max payload size             | 6MB            |
| Max length for a document ID | 512 characters |
| Max vector dimensions        | 4,096          |
| Max document size            | 5MB            |
