---
title: "Update objects"
description: "How to update objects in Weaviate with code examples in Python, TypeScript, Go, Java, and C#."
url: https://docs.weaviate.io/weaviate/manage-objects/update
---

# Update objects

Weaviate allows partial or complete object updates.

**Additional information**

- Partial updates use [`PATCH` requests to the `/v1/objects` REST API endpoint](https://docs.weaviate.io/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](https://docs.weaviate.io/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](https://docs.weaviate.io/weaviate/manage-collections/vector-config#property-level-settings)).
- To update objects, you must provide the collection name, id and properties to update.
- For [multi-tenancy](https://docs.weaviate.io/weaviate/concepts/data#multi-tenancy) collections, you will also need to specify the tenant name. See [Manage data: multi-tenancy operations](https://docs.weaviate.io/weaviate/manage-collections/multi-tenancy) for details on how.

> [!WARNING]
>
> **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](https://docs.weaviate.io/weaviate/concepts/data#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.

**Python**

```py
uuid = "..."  # replace with the id of the object you want to update

jeopardy = client.collections.use("JeopardyQuestion")
jeopardy.data.update(
    uuid=uuid,
    properties={
        "points": 100,
    }
)
```

**JavaScript/TypeScript**

```ts
const myCollection = client.collections.use('JeopardyQuestion') 
const response = await myCollection.data.update({
  id: 'ed89d9e7-4c9d-4a6a-8d20-095cb0026f54',
  properties: {
    'points': 100,
  },
})

console.log(response)
```

**Go (v5)**

```go
id := "..." // replace with the id of the object you want to update
client.Data().Updater().
  WithMerge(). // merges properties into the object
  WithID(id).
  WithClassName("JeopardyQuestion").
  WithProperties(map[string]interface{}{
  	"points": 100,
  }).
  Do(ctx)
```

**Go (v6)**

```go
questions := client.Collections.Use("JeopardyQuestion")
id := uuid.MustParse("a3b4c5d6-e7f8-4a9b-8c0d-1e2f3a4b5c6d") // The object to update.

err := questions.Data.Update(ctx, data.Object{
  UUID: &id,
  Properties: map[string]any{
    "points": 100,
  },
})
if err != nil {
  // handle error
  panic(err)
}
```

**Java**

```java
jeopardy.data.update(uuid,
    u -> u.properties(Map.of("points", 100.0))
);
```

**C#**

```csharp
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](https://docs.weaviate.io/weaviate/config-refs/collections#named-vectors), provide the data as a dictionary/map similarly to the [object creation](https://docs.weaviate.io/weaviate/manage-objects/create#create-an-object-with-named-vectors).

**Python**

```py
jeopardy = client.collections.use("JeopardyQuestion")
jeopardy.data.update(
    uuid=uuid,
    properties={
        "points": 100,
    },
    vector=[0.12345] * 1536
)
```

**JavaScript/TypeScript**

```ts
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)
```

**Go (v6)**

```go
questions := client.Collections.Use("JeopardyQuestion")
id := uuid.MustParse("c4d5e6f7-a8b9-4c0d-8e1f-2a3b4c5d6e7f") // The object to update.

err := questions.Data.Update(ctx, data.Object{
  UUID: &id,
  Vectors: []types.Vector{
    {Name: "default", Single: []float32{0.12345, 0.6789, 0.9876}},
  },
})
if err != nil {
  // handle error
  panic(err)
}
```

**Java**

```java
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))
);
```

**C#**

```csharp
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.

**Python**

```py
jeopardy = client.collections.use("JeopardyQuestion")
jeopardy.data.replace(
    uuid=uuid,
    properties={
        "answer": "Replaced",
        # The other properties will be deleted
    },
)
```

**JavaScript/TypeScript**

```ts
const myCollection = client.collections.use('JeopardyQuestion') 
const response = await myCollection.data.replace({
  id: 'ed89d9e7-4c9d-4a6a-8d20-095cb0026f54',
  properties: {
    'answer': 'Replaced',
    // The other properties will be deleted
  },
})

console.log(response)
```

**Go (v5)**

```go
id := "..." // replace with the id of the object you want to update
client.Data().Updater(). // replaces the entire object
  WithID(id).
  WithClassName("JeopardyQuestion").
  WithProperties(map[string]interface{}{
  	"answer": "Replaced",
  	// The other properties will be deleted
  }).
  Do(ctx)
```

**Go (v6)**

```go
questions := client.Collections.Use("JeopardyQuestion")
id := uuid.MustParse("e1f2a3b4-c5d6-4e7f-8a9b-4c5d6e7f8a9b") // The object to replace.

err := questions.Data.Replace(ctx, data.Object{
  UUID: &id,
  Properties: map[string]any{
    "answer": "Replaced",
    // The other properties are deleted.
  },
})
if err != nil {
  // handle error
  panic(err)
}
```

**Java**

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

**C#**

```csharp
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.

**Python**

```py
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
del_props(client, uuid, "JeopardyQuestion", ["answer"])
```

**JavaScript/TypeScript**

```ts
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 (v5)**

```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
}

id := "..." // replace with the id of the object you want to update
isUpdated, err := delProps(id, "JeopardyQuestion", "answer")
```

**Go (v6)**

```go
questions := client.Collections.Use("JeopardyQuestion")
id := uuid.MustParse("b1e2d3c4-a5f6-4e7d-8c9b-1a2b3c4d5e6f") // The object to update.
propNames := []string{"answer"}                              // The properties to delete.

// Fetch the object.
response, err := questions.Query.OverAll(ctx, query.OverAll{
  Filter: &filter.Cond{Target: filter.UUID, Operator: filter.Equal, Value: id},
})
if err != nil {
  // handle error
  panic(err)
}
if len(response.Objects) == 0 {
  panic("object not found")
}

// Remove the unwanted properties.
properties := response.Objects[0].Properties
for _, name := range propNames {
  delete(properties, name)
}

// Replace the object with the remaining properties.
err = questions.Data.Replace(ctx, data.Object{UUID: &id, Properties: properties})
if err != nil {
  // handle error
  panic(err)
}
```

**Java**

```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));
  }

    delProps(client, uuid, "JeopardyQuestion", List.of("answer"));
```

**C#**

```csharp
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);
}


    await DelProps(client, uuid, "JeopardyQuestion", new[] { "answer" });
```

## Related pages

- [Connect to Weaviate](https://docs.weaviate.io/weaviate/connections)

- [References: REST - /v1/objects](https://docs.weaviate.io/weaviate/api/rest#tag/objects/put/objects/%7BclassName%7D/%7Bid%7D)
