Skip to content

+MongoDB Vector Support #2367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

+MongoDB Vector Support #2367

wants to merge 11 commits into from

Conversation

ranfysvalle02
Copy link

Description

Add MongoDB as a VectorDB.

Fixes # (issue)

#1166

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

There is working code that highlights how to use, and the output.

Please delete options that are not relevant.

  • Unit Test
  • Test Script
config = {
    "vector_store": {
        "provider": "mongodb",
        "config": {
            "mdb_uri": "mongodb://0.0.0.0/?directConnection=true",
            "dbname": "DEMO",
            "collection_name": "TEST",
            "get_embedding": get_embedding,
            "embedding_model_dims": len(get_embedding("0")),
        }
    }
}
m = Memory.from_config(config)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed

Copy link

vercel bot commented Mar 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
multimodal-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 3:19am

@ranfysvalle02
Copy link
Author

@Dev-Khant could you please take a look at this one?

Copy link
Member

@Dev-Khant Dev-Khant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the relevant docs and tests for it. Thanks.

@ranfysvalle02
Copy link
Author

@Dev-Khant will add this soon! Sorry for delay

@CLAassistant
Copy link

CLAassistant commented Apr 8, 2025

CLA assistant check
All committers have signed the CLA.

dgupta18 added 2 commits April 8, 2025 17:29
Adding initial tests, updating use of get_embeddings

Remove accidental formatting to unrelated files

Fixing tests

Fixing docs, adding comment

Remove get_embeddings
@dgupta18
Copy link

Hi @Dev-Khant , this PR is ready for re-review when you get a second!

@ranfysvalle02 ranfysvalle02 requested a review from Dev-Khant April 10, 2025 19:37
@coder-pikachu
Copy link

When would this be closed?

@Dev-Khant
Copy link
Member

Hey @ranfysvalle02 Can you please resolve the merge conflicts so we can run the CI tests.

@ranfysvalle02
Copy link
Author

@Dev-Khant -- merge conflicts resolved!!!

@ranfysvalle02
Copy link
Author

@Dev-Khant - Just following up here, let me know if any issues

@ranfysvalle02
Copy link
Author

@Dev-Khant --- We are about to have more merge conflicts -- Can you please advise if there is anything wrong with the MongoDB aspect of it or help get this merged please?

Copy link
Member

@Dev-Khant Dev-Khant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry the delay here. Left few comments once it's resolved we can merge this.

"""Configuration for MongoDB vector database."""

db_name: str = Field("mem0_db", description="Name of the MongoDB database")
collection_name: str = Field("mem0_collection", description="Name of the MongoDB collection")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep collection name as mem0

pyproject.toml Outdated
@@ -31,6 +31,7 @@ langchain-neo4j = "^0.4.0"
neo4j = "^5.23.1"
rank-bm25 = "^0.2.2"
psycopg2-binary = "^2.9.10"
pymongo = "^4.12.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove pymongo from the default dependencies. User can install this separately when they want to use mongodb

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the reset method as well?

poetry.lock Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will no poetry changes once you remove the pymonogo from default dependencies

@Dev-Khant
Copy link
Member

Also @ranfysvalle02 Can you please why the monogodb tests are failing?

@ranfysvalle02
Copy link
Author

@Dev-Khant give me a bit to tackle all this -- will report back soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants