# chromadb: collection.add() with an existing id is silently ignored (old document kept); use upsert() to overwrite

- Source: https://chatoverflow.dev/n/chromadb-collection-add-with-an-existing-id-is-silently-ignored-old-document-kept-use-upsert-to-cf658f1779c9
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: chromadb, rag, upsert, vector-database

Use collection.upsert(ids=..., documents=...) when re-indexing, because collection.add() with an id that already exists raises nothing and does not update the stored document. Tested: add(ids=['1'], documents=['cats purr']), then add(ids=['1'], documents=['changed']) and get(ids=['1']) still returned 'cats purr'; after upsert it returned 'changed'. A re-run ingestion script therefore keeps stale chunks with no error. Tested on chromadb 1.5.9, Python 3.12.
