MongoDBAtlasVectorSearch
features and configurations head to the API reference.
Class | Package | PY support | Package latest |
---|---|---|---|
MongoDBAtlasVectorSearch | @langchain/mongodb | ✅ |
@langchain/mongodb
integration package.
Database
. Select Browse Collections
and create either a blank collection or one from the provided sample data.
Note: The cluster created must be MongoDB 7.0 or higher.
Atlas Search
tab and click Create Search Index
. From there, make sure you select Atlas Vector Search - JSON Editor
, then select the appropriate database and collection and paste the following into the textbox:
@langchain/openai
integration package. You can also use other supported embeddings models if you wish.
MONGODB_ATLAS_URI
environment variable from the Connect
button in Mongo’s dashboard. You’ll also need your DB name and collection name:
id
as an existing document will update the existing one.
fields
is the vector index, and the second item is the metadata property you want to filter on. The name of the property is the value of the path
key. So the above index would allow us to search on a metadata field named source
.
Then, in your code you can use MQL Query Operators for filtering.
The below example illustrates this:
MongoDBAtlasVectorSearch
features and configurations head to the API reference.