Skip to content

MongoDB vector store

MongoDB Atlas Vector Search, selected via VECTOR_STORE_PROVIDER=mongodb.

Enable it

bash
VECTOR_STORE_PROVIDER=mongodb
MONGODB_URI=mongodb://localhost:27017
MONGODB_DB=suprflo

Install the client: pip install pymongo.

Configuration

VariableDefaultDescription
VECTOR_STORE_PROVIDERpgvectorSet to mongodb to use this store.
MONGODB_URImongodb://localhost:27017Connection URI for the MongoDB deployment.
MONGODB_DBsuprfloDatabase name used for the memory collection.

Notes

  • Unit-tested against a mocked pymongo client, not integration-tested against a real Atlas cluster. The $vectorSearch/$text pipelines are asserted structurally, not executed, so smoke-test before production use.
  • Requires MongoDB Atlas (or a local Atlas-enabled deployment) for the $vectorSearch stage. On a plain community/self-hosted mongod, search and search_with_vectors will fail; everything else (get/list/count/update/delete/invalidate/keyword_search) works on any MongoDB.
  • keyword_search uses the classic $text operator over a text index on payload.data, so it works on any MongoDB without Atlas.
  • $vectorSearch pre-filters may only reference fields declared as filter paths in the Atlas index definition; filtering on an arbitrary metadata key not in that list is rejected by Atlas.
  • Atlas normalizes the cosine score to (1 + cosine) / 2 (pgvector returns raw 1 - distance), and $text scores are Mongo's tf-idf-ish textScore, so absolute scores are not comparable across backends though ranking is. valid_to uses a far-future sentinel datetime for 'infinity'.

The memory layer for AI agents.