# Update objects

Weaviate allows partial or complete object updates.

::::accordion{title="Additional information"}
- Partial updates use [`PATCH` requests to the `/v1/objects` REST API endpoint](/weaviate/api/rest#tag/objects/patch/objects/%7BclassName%7D/%7Bid%7D) under the hood.
- Complete updates use [`PUT` requests to the `/v1/objects` REST API endpoint](/weaviate/api/rest#tag/objects/put/objects/%7BclassName%7D/%7Bid%7D) under the hood.
- Updates that include a `vector` property will recalculate the vector embedding (unless all updated `text` properties are [skipped](../how-to-manage-collections/vector-config.md#property-level-settings)).
- To update objects, you must provide the collection name, id and properties to update.
- For [multi-tenancy](../concepts/data.md#multi-tenancy) collections, you will also need to specify the tenant name. See [Manage data: multi-tenancy operations](../how-to-manage-collections/multi-tenancy.md) for details on how.

:::callout{intent="warning" title="Collection (class) Name in Object CRUD Operations"}
Collections act like namespaces, so two different collections could have duplicate IDs between them.

Prior to Weaviate `v1.14` you can manipulate objects without specifying the collection name. This method is deprecated. It will be removed in Weaviate `v2.0.0`.

Starting in `v1.20`, you can have [multi-tenant](../concepts/data.md#multi-tenancy) datasets. When `multi-tenancy` is enabled, the tenant name is required.

Always include the collection name, and, when enabled, the tenant name.
:::
::::

## Update object properties

This operation replaces the entire value of the specified properties only, leaving the unspecified properties. Provide the collection name, the object id, and the properties to update.

If you update the value of a _previously vectorized_ property, Weaviate re-vectorizes the object automatically. This also reindexes the updated object.

However, if you add a _new_ property to your collection definition, Weaviate only vectorizes the new objects. Weaviate doesn't re-vectorize and re-index existing objects when a new property is defined, only when an existing property is updated.

:::code-group{sync="languages"}
```python title="Python"
uuid = "..."  # replace with the id of the object you want to update
```

```typescript title="JavaScript/TypeScript"
const myCollection = client.collections.use('JeopardyQuestion')
```

```go title="Go"
id := "..." // replace with the id of the object you want to update
```

```java title="Java" {2}
jeopardy.data.update(uuid,
    u -> u.properties(Map.of("points", 100.0))
);
```

```csharp title="C#" {3}
await jeopardy.Data.Replace(
    uuid,
    properties: new { points = 100 }
);
```
:::

## Update object vector

The object vector can also be updated similarly to properties. For [named vectors](../reference-configuration/collections.md#multiple-vector-embeddings-named-vectors), provide the data as a dictionary/map similarly to the [object creation](create.md#create-an-object-with-named-vectors).

::::tabs{sync="languages"}
:::tab{title="Python"}
```python {7}
jeopardy = client.collections.use("JeopardyQuestion")
jeopardy.data.update(
    uuid=uuid,
    properties={
        "points": 100,
    },
    vector=[0.12345] * 1536
)
```
:::

:::tab{title="JavaScript/TypeScript"}
```typescript {4}
const jeopardy = client.collections.use('JeopardyQuestion')
const response = await jeopardy.data.update({
  id: 'ed89d9e7-4c9d-4a6a-8d20-095cb0026f54',
  vectors: Array(1536).fill(0.12345), // new vector value
})

console.log(response)
```
:::

:::tab{title="Go"}
> Coming soon
:::

:::tab{title="Java"}
```java {5}
float[] vector = new float[384];
Arrays.fill(vector, 0.12345f);

jeopardy.data.update(uuid, u -> u.properties(Map.of("points", 100.0))
    .vectors(Vectors.of(vector))
);
```
:::

:::tab{title="C#"}
```csharp {4}
await jeopardy.Data.Replace(
    uuid,
    properties: new { points = 100 },
    vectors: vector
);
```
:::
::::

## Replace an entire object

The entire object can be replaced by providing the collection name, id and the new object.

:::code-group{sync="languages"}
```python title="Python" {2}
jeopardy = client.collections.use("JeopardyQuestion")
jeopardy.data.replace(
    uuid=uuid,
    properties={
        "answer": "Replaced",
        # The other properties will be deleted
    },
)
```

```typescript title="JavaScript/TypeScript"
const myCollection = client.collections.use('JeopardyQuestion')
```

```go title="Go"
id := "..." // replace with the id of the object you want to update
```

```java title="Java" {1}
jeopardy.data.replace(
    uuid, r -> r.properties(Map.of("answer", "Replaced"
    // The other properties will be deleted
    )));
```

```csharp title="C#" {1}
await jeopardy.Data.Replace(
    uuid,
    properties: new { answer = "Replaced" }
// The other properties will be deleted
);
```
:::

## Delete a property

Deleting or updating properties in the collection definition is [not yet supported](https://github.com/weaviate/weaviate/issues/2848).

At object level, you can replace the object with a copy that has those properties deleted, or set to `""` for text properties.

:::code-group{sync="languages"}
```python title="Python"
from typing import List
from weaviate import WeaviateClient

def del_props(client: WeaviateClient, uuid_to_update: str, collection_name: str, prop_names: List[str]) -> None:
    collection = client.collections.use(collection_name)

    # fetch the object to update
    object_data = collection.query.fetch_object_by_id(uuid_to_update)
    properties_to_update = object_data.properties

    # remove unwanted properties
    for prop_name in prop_names:
        if prop_name in properties_to_update:
            del properties_to_update[prop_name]

    # replace the properties
    collection.data.replace(
        uuid=uuid_to_update,
        properties=properties_to_update
    )


uuid = "..."  # replace with the id of the object you want to delete properties from
```

```typescript title="JavaScript/TypeScript"
async function deleteProperties(client: WeaviateClient, uuidToUpdate: string, collectionName: string, propNames: string[]) {
  const collection = client.collections.use(collectionName);
  const objectData = await collection.query.fetchObjectById(uuidToUpdate);
  const propertiesToUpdate = objectData?.properties;
  
  if (propertiesToUpdate) {
    for (let propName of propNames) {
        if (propName in propertiesToUpdate) {
          delete propertiesToUpdate[propName];
        }
    }
  
    let result = await collection.data.replace({
      id: uuidToUpdate,
      properties: propertiesToUpdate
    })
  }
}
  
let id = 'ed89d9e7-4c9d-4a6a-8d20-095cb0026f54'
deleteProperties(client, id, 'JeopardyQuestion', ['answer'])
```

```go title="Go"
delProps := func(uuid, className string, propNames ...string) (bool, error) {
  objs, err := client.Data().ObjectsGetter().WithID(uuid).WithClassName(className).Do(ctx)
  if err != nil {
    return false, err
  }
  if objs == nil || len(objs) == 0 {
    return false, fmt.Errorf("object with id: %v not found", uuid)
  }
  if objs[0].Properties == nil {
    return false, fmt.Errorf("object with id: %v has no properties", uuid)
  }
  properties := objs[0].Properties.(map[string]interface{})
  for _, propName := range propNames {
    delete(properties, propName)
  }
  err = client.Data().Updater().
    WithID(uuid).
    WithClassName(className).
    WithProperties(properties).
    Do(ctx)
  return err == nil, err
}
```

```javaraw title="Java"
private static void delProps(WeaviateClient client, String uuidToUpdate, String collectionName,
    List<String> propNames) throws IOException {
  CollectionHandle<Map<String, Object>> collection = client.collections.use(collectionName);

  // fetch the object to update
  Optional<WeaviateObject<Map<String, Object>>> objectDataOpt =
      collection.query.fetchObjectById(uuidToUpdate);
  if (objectDataOpt.isEmpty()) {
    return;
  }
  Map<String, Object> propertiesToUpdate = new HashMap<>(objectDataOpt.get().properties());

  // remove unwanted properties
  for (String propName : propNames) {
    propertiesToUpdate.remove(propName);
  }

  // replace the properties
  collection.data.replace(uuidToUpdate, r -> r.properties(propertiesToUpdate));
}
```

```csharpraw title="C#"
private static async Task DelProps(
    WeaviateClient client,
    Guid uuidToUpdate,
    string collectionName,
    IEnumerable<string> propNames
)
{
    var collection = client.Collections.Use(collectionName);

    // fetch the object to update
    var objectData = await collection.Query.FetchObjectByID(uuidToUpdate);
    if (objectData?.Properties is not IDictionary<string, object> propertiesToUpdate)
    {
        return;
    }

    // remove unwanted properties
    foreach (var propName in propNames)
    {
        propertiesToUpdate.Remove(propName);
    }

    // replace the properties
    await collection.Data.Replace(uuidToUpdate, propertiesToUpdate);
}
```
:::

## Related pages

- [Connect to Weaviate](../connect-to-weaviate/index.md)
- [References: REST - /v1/objects](/weaviate/api/rest#tag/objects/put/objects/%7BclassName%7D/%7Bid%7D)

## Questions and feedback

Have a question or feedback? Here's how to reach us.

::::card-grid
:::card{title="Community Forum" href="https://forum.weaviate.io/c/support" icon="messages-square"}
Ask questions and connect with other developers on our **Community forum**.
:::

:::card{title="Support" href="/guides/support-overview" icon="life-buoy"}
Weaviate Cloud user or customer? Find the right channel on the **Support page**.
:::
::::

## Related pages

- [Agents](./agents-index.md)
- [AI-assisted Weaviate code generation](./ai-assisted-vibe-coding-index.md)
- [APIs](./apis-index.md)
- [Authorization and authentication](./authorization-and-authentication-index.md)
- [Benchmarks](./benchmarks-index.md)
- [Best practices](./best-practices-index.md)
- [Client libraries](./clients-index.md)
- [Client Libraries / SDKs](./client-libraries-index.md)
- [Cloud](./cloud-index.md)
- [Cloud account management](./cloud-account-management-index.md)

# Agent Instructions

This portal answers questions programmatically. To receive a synthesized,
source-cited answer instead of crawling page by page, append the `?ask=`
query parameter to any page URL on this site:

    /guides/quickstart?ask=how+do+I+authenticate

Optional parameters:

- `&goal=<what-you-are-trying-to-do>` steers the answer toward your
  objective (e.g. `&goal=write+a+python+client`).
- `&version=<label>` scopes the answer to a mounted version when the
  portal publishes more than one.

The response is `text/markdown`: the answer followed by a `# Sources` list
of the portal pages it was grounded in. Status codes are the contract:

- `200` — the answer; `402` — the portal owner’s plan or answer credits are
  exhausted (surface this to your operator; do NOT retry); `429` — you are
  rate-limited; back off for the `Retry-After` seconds; `503` — the answer
  lane is temporarily unavailable; fall back to crawling the `.md` pages.

For the full corpus map read `llms.txt` at the site root; for the tool
surface (search + page fetch as MCP tools) see `/mcp`.
