# Update an object through LangChain

**URL:** https://forum.weaviate.io/t/update-an-object-through-langchain/9096
**Category:** Support
**Tags:** python
**Created:** [December 4, 2024, 4:04pm UTC](https://forum.weaviate.io/t/update-an-object-through-langchain/9096 "2024-12-04T16:04:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Troligen](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/troligen/32/3104_2.png) [@Troligen](https://forum.weaviate.io/u/Troligen)
#### Post date: [December 4, 2024, 4:04pm UTC](https://forum.weaviate.io/t/update-an-object-through-langchain/9096/1 "2024-12-04T16:04:41Z")

</div>

### Description

I’m trying to find if it’s possible to update an object through the WeaviateVectorStore module.

U can use WeaviateVectorStore to add documents and initiate a connection to a collection but I can’t find if there’s any way to update some object inside of a collection.

It seems weird that langchain would limit you to just adding objects and then force you to use the native weaviate solution to update an object.

### Server Setup Information

- Weaviate Server Version: 0.4
- Deployment Method: docker
- Client Language and Version: Python

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [December 5, 2024, 2:55pm UTC](https://forum.weaviate.io/t/update-an-object-through-langchain/9096/2 "2024-12-05T14:55:03Z")

</div>

hi @Troligen !!

Welcome to our community 🤗

You need to pass the uuid to that doc as the `id` parameter

Here is a code example in python:

```python
from weaviate.util import generate_uuid5
from langchain_weaviate.vectorstores import WeaviateVectorStore
from langchain_openai import OpenAIEmbeddings
from langchain.docstore.document import Document

embeddings = OpenAIEmbeddings()
doc = Document(page_content="text1", metadata={"source": "local"}, id=generate_uuid5("my-id"))
db = WeaviateVectorStore.from_documents([doc], embeddings, client=client, index_name="Test")

```

now we can check our doc:

```python
client.collections.get("Test").query.fetch_objects().objects[0].properties
# {'text': 'text1', 'source': 'local'}

```

Let’s update that object

```python
doc = Document(page_content="text1_changed", metadata={"source": "local"}, id=generate_uuid5("my-id"))
db = WeaviateVectorStore.from_documents([doc], embeddings, 
client=client, index_name="Test")

```

We have updated!

```python
client.collections.get("Test").query.fetch_objects().objects[0].properties
# {'text': 'text1_changed', 'source': 'local'}

```

Let me know if this helps!

Thanks!

---

<div class="post-metadata">

### Author: ![Troligen](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/troligen/32/3104_2.png) [@Troligen](https://forum.weaviate.io/u/Troligen)
#### Post date: [December 6, 2024, 11:31am UTC](https://forum.weaviate.io/t/update-an-object-through-langchain/9096/3 "2024-12-06T11:31:15Z")

</div>

Thanks you for your warm welcome and thank you for the solution!

I see you’re using the deterministic ID which seems to make the handling of the updates more streamlined as well?

In any case thank you for the help!

Best Regards,  
Jesper/Troligen
