You can name the index langchain_demo and create the index on the namespace lanchain_db.langchain_col. Finally, write the following definition in the JSON editor on MongoDB Atlas:{  "mappings": {    "dynamic": true,    "fields": {      "embedding": {        "dimensions": 1536,        "similarity": "cosine",        "type": "knnVector"      }    }  }}from langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import MongoDBAtlasVectorSearchfrom langchain.document_loaders import TextLoaderloader = TextLoader("../../modules/state_of_the_union.txt")documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()from pymongo import MongoClient# initialize MongoDB python clientclient = MongoClient(MONGODB_ATLAS_CLUSTER_URI)db_name = "langchain_db"collection_name = "langchain_col"collection = client[db_name][collection_name]index_name = "langchain_demo"# insert the documents in MongoDB Atlas with their embeddingdocsearch = MongoDBAtlasVectorSearch.from_documents(    docs, embeddings, collection=collection, index_name=index_name)# perform a similarity search between the embedding of the query and the embeddings of the documentsquery = "What did the president say about Ketanji Brown Jackson"docs = docsearch.similarity_search(query)print(docs[0].page_content)You can also instantiate the vector store directly and execute a query as follows:# initialize vector storevectorstore = MongoDBAtlasVectorSearch(    collection, OpenAIEmbeddings(), index_name=index_name)# perform a similarity search between a query and the ingested documentsquery = "What did the president say about Ketanji Brown Jackson"docs = vectorstore.similarity_search(query)print(docs[0].page_content)PreviousMomento Vector Index (MVI)NextMyScaleCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain,
MongoDB Atlas is a fully-managed cloud database available in AWS, Azure, and GCP.  It now has support for native Vector Search on your MongoDB document data.
MongoDB Atlas is a fully-managed cloud database available in AWS, Azure, and GCP.  It now has support for native Vector Search on your MongoDB document data. ->: You can name the index langchain_demo and create the index on the namespace lanchain_db.langchain_col. Finally, write the following definition in the JSON editor on MongoDB Atlas:{  "mappings": {    "dynamic": true,    "fields": {      "embedding": {        "dimensions": 1536,        "similarity": "cosine",        "type": "knnVector"      }    }  }}from langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import MongoDBAtlasVectorSearchfrom langchain.document_loaders import TextLoaderloader = TextLoader("../../modules/state_of_the_union.txt")documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()from pymongo import MongoClient# initialize MongoDB python clientclient = MongoClient(MONGODB_ATLAS_CLUSTER_URI)db_name = "langchain_db"collection_name = "langchain_col"collection = client[db_name][collection_name]index_name = "langchain_demo"# insert the documents in MongoDB Atlas with their embeddingdocsearch = MongoDBAtlasVectorSearch.from_documents(    docs, embeddings, collection=collection, index_name=index_name)# perform a similarity search between the embedding of the query and the embeddings of the documentsquery = "What did the president say about Ketanji Brown Jackson"docs = docsearch.similarity_search(query)print(docs[0].page_content)You can also instantiate the vector store directly and execute a query as follows:# initialize vector storevectorstore = MongoDBAtlasVectorSearch(    collection, OpenAIEmbeddings(), index_name=index_name)# perform a similarity search between a query and the ingested documentsquery = "What did the president say about Ketanji Brown Jackson"docs = vectorstore.similarity_search(query)print(docs[0].page_content)PreviousMomento Vector Index (MVI)NextMyScaleCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain,