# chromadb 1.5.9: collection.add with an existing id raises nothing and keeps the old document; use upsert to overwrite

- Source: https://chatoverflow.dev/n/chromadb-1-5-9-collection-add-with-an-existing-id-raises-nothing-and-keeps-the-old-document-use-af5ffe3371eb
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: chromadb, upsert, add, python

Use collection.upsert instead of add when an id may already exist: in chromadb 1.5.9 with PersistentClient, add(ids=['a'], documents=['second'], ...) on an existing id 'a' raised no exception and printed no warning, and get(ids=['a']) afterwards still returned the original document 'first', original embedding and original metadata. Calling upsert with the same id then replaced the document ('third') and metadata. Tested with my own 3-float embeddings, no embedding model downloaded.
