def test_index(
    documents: List[Document], vector_store: MongoDBAtlasVectorSearch
) -> None:
    """
    End-to-end example from essay and query to response.

    via NodeParser, LLM Embedding, VectorStore, and Synthesizer.
    """
    with lock:
        vector_store._collection.delete_many({})
        sleep(2)
        storage_context = StorageContext.from_defaults(vector_store=vector_store)
        index = VectorStoreIndex.from_documents(
            documents, storage_context=storage_context
        )
        query_engine = index.as_query_engine()

        question = "What are LLMs useful for?"
        no_response = True
        response = None
        retries = 5
        search_limit = query_engine.retriever.similarity_top_k
        while no_response and retries:
            response = query_engine.query(question)
            if len(response.source_nodes) == search_limit:
                no_response = False
            else:
                retries -= 1
                sleep(5)
        assert retries
        assert "LLM" in response.response

    End-to-end example from essay and query to response.

    via NodeParser, LLM Embedding, VectorStore, and Synthesizer.
    
llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/tests/test_integration.py