Find answers from the community

Updated 7 months ago

Mogno

Plain Text
mongodb_client = pymongo.MongoClient(mongo_uri)
store = MongoDBAtlasVectorSearch(mongodb_client)
storage_context = StorageContext.from_defaults(vector_store=store)
user_docs = SimpleDirectoryReader(
    input_files=[doc_path]

).load_data()
index = VectorStoreIndex.from_documents(
    user_docs, storage_context=storage_context
)
# print(store._collection.count_documents({}))


response = index.as_query_engine().query(query)
print(f"query: {query}")
print(f"response: {response}")


Can someone spot why I'm getting 'Empty Response' with this?
L
H
R
11 comments
Did you create the vector search index in the atlas dashboard?
It's a very annoying manual step that mongo db makes you do
I did through their web, and I see that the documents are stored. But the query returns notjhing
So in the GUI, you have a vector search index properly configured on the correct collection?
(This is really easy to get wrong)
Do you see something weird?
i don't know the default behavior of the MongoDBAtlasVectorSearch but don't you have to pass it a db name and a collection name? i don't see the collection anywhere
you can actually do it with .add
Plain Text
vector_store = MongoDBAtlasVectorSearch(mongo_client, db_name=DB_NAME, collection_name=COLLECTION_NAME, index_name="vector_index")
vector_store.add(nodes)
Add a reply
Sign up and join the conversation on Discord