def from_connection_string(
        cls,
        connection_string: str,
        db_name: Optional[str] = None,
        collection_name: Optional[str] = None,
    ):
        """Creates an instance of AzureCosmosMongoVCoreChatStore using a connection string."""
        # Parse the MongoDB URI
        parsed_uri = urllib.parse.urlparse(connection_string)
        # Extract username and password, and perform url_encoding
        username = urllib.parse.quote_plus(parsed_uri.username)
        password = urllib.parse.quote_plus(parsed_uri.password)

        encoded_conn_string = f"mongodb+srv://{username}:{password}@{parsed_uri.hostname}/?{parsed_uri.query}"
        mongo_client = MongoClient(encoded_conn_string, appname=APP_NAME)

        return cls(
            mongo_client=mongo_client,
            db_name=db_name,
            collection_name=collection_name,
        )
Creates an instance of AzureCosmosMongoVCoreChatStore using a connection string.
llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-azurecosmosmongovcore/llama_index/storage/chat_store/azurecosmosmongovcore/base.py