TubeSum

Build an AI Recommendation Engine — Step-by-Step Guide & Transcript

How to Build an AI Recommendation Engine (That Actually Works)

0h 28m video Published Feb 17, 2026 Transcribed Aug 8, 2026 M Milan Jovanović
Intermediate 12 min read For: .NET developers with basic knowledge of MongoDB and an interest in integrating AI/vector search into their applications.
AI Trust Score 85/100
✅ Highly Legit

"Delivers exactly what the title promises: a step-by-step, working implementation of an AI recommendation engine."

AI Summary

This video provides a practical, step-by-step guide to building a content recommendation engine using AI. The core idea is to convert blog post text into vector embeddings and use MongoDB's native vector search to find and recommend related articles. The tutorial covers everything from choosing an embedding model to implementing the search and filtering out self-recommendations.

[00:41]
Problem Statement: Content Recommendations

The goal is to recommend related articles to readers at the end of a blog post, keeping them engaged on the website.

[01:24]
Core Concept: Vector Embeddings and Search

Text is converted into arrays of floating-point numbers (vector embeddings) using an embedding LLM. MongoDB's vector search finds similar vectors.

[02:36]
Embedding Model: Voyage 4 Series

The Voyage 4 model family (Large, 4, Light, Nano) uses a shared embedding space, allowing different models for indexing and querying for optimal performance.

[04:11]
Local Setup with Ollama and Aspire

Ollama is used to run the Voyage 4 Nano model locally, integrated into a .NET Aspire application using the CommunityToolkit.Aspire.Hosting.Ollama package.

[07:29]
MongoDB Local Setup

A local MongoDB instance with vector search support is run using the MongoDB Atlas local Docker image.

[10:43]
API Endpoints: Embedding Generation and Search

A POST endpoint generates embeddings for all articles from a sitemap and stores them in MongoDB. A GET endpoint performs vector search to recommend related articles.

[24:44]
Fixing Self-Recommendation with Filters

The initial search returns the same article as the top result. This is fixed by adding a filter field to the vector search index and excluding the current article's title in the query.

Mentioned in this Video

Tutorial Checklist

1 05:09 Install the CommunityToolkit.Aspire.Hosting.Ollama NuGet package in the Aspire app host project.
2 05:40 Configure Ollama as a resource in the Aspire app host, adding the Voyage 4 Nano model from Hugging Face.
3 06:50 Install the CommunityToolkit.Aspire.Ollama NuGet package in the API project and register the Ollama API client as an IEmbeddingGenerator.
4 07:55 Run a local MongoDB Atlas Docker container: `docker run -d -p 27017:27017 --name mongodb-local mongodb/mongodb-atlas-local`.
5 08:52 Add a connection string to the MongoDB instance in the Aspire app host and register the IMongoClient as a singleton service in the API project.
6 10:43 Create a POST endpoint that reads article URLs from a sitemap file, fetches content, generates embeddings using the IEmbeddingGenerator, and stores them in MongoDB using InsertManyAsync.
7 18:49 Create a vector search index in MongoDB on the 'embedding' field with 1024 dimensions and Euclidean similarity.
8 19:44 Create a GET endpoint that generates an embedding for a given article, performs a vector search using the collection.Aggregate().VectorSearch() method, and returns the results.
9 25:27 Update the vector search index to include a filter field on the 'title' path, and modify the query to exclude the current article's title using the Filter property in VectorSearchOptions.

Study Flashcards (11)

What are vector embeddings?

easy Click to reveal answer

Vector embeddings are arrays of floating-point numbers that represent the semantic meaning of text, generated by an embedding large language model.

01:24

What database feature does MongoDB provide for finding similar vectors?

easy Click to reveal answer

MongoDB has native support for vector search, allowing you to find similar vectors to a given query vector.

01:09

Name the four models in the Voyage 4 series mentioned in the video.

medium Click to reveal answer

Voyage 4 Large, Voyage 4, Voyage 4 Light, and Voyage 4 Nano.

02:36

What is the key advantage of the Voyage 4 models using a shared embedding space?

hard Click to reveal answer

A shared embedding space allows you to use different models (e.g., a large one for indexing and a light one for queries) interchangeably because their embeddings are compatible.

03:04

Which NuGet package is used to add Ollama as a resource in an Aspire app host?

medium Click to reveal answer

The CommunityToolkit.Aspire.Hosting.Ollama NuGet package.

05:09

Which NuGet package is used to interact with the Ollama API from a .NET application?

medium Click to reveal answer

The CommunityToolkit.Aspire.Ollama NuGet package, which provides an IEmbeddingGenerator abstraction.

06:50

What Docker image is used to run a local MongoDB instance that supports vector search?

medium Click to reveal answer

The MongoDB Atlas local Docker image.

07:55

How many dimensions does the Voyage 4 Nano model produce for its vector embeddings?

medium Click to reveal answer

1024.

17:12

What three similarity methods are available for vector comparisons in MongoDB?

medium Click to reveal answer

Euclidean, cosine, and dot product.

19:18

What is the trade-off between exact and approximate nearest neighbor search in MongoDB?

hard Click to reveal answer

Exact nearest neighbor search is the most precise but slowest, while approximate nearest neighbor search is faster but less precise.

21:35

How was the problem of the recommendation engine returning the same article fixed?

hard Click to reveal answer

By adding a filter field to the vector search index and using it in the query to exclude the current article's title.

25:27

💡 Key Takeaways

🔧

Shared Embedding Space Concept

Explains a powerful optimization: using a large model for offline indexing and a lightweight model for real-time queries, enabled by a shared embedding space.

03:04
🔧

Exact vs. Approximate Nearest Neighbor Search

Clarifies the trade-off between precision and speed in vector search, a critical decision for production systems.

21:35
📊

Vector Search in MongoDB Community Edition

Highlights that vector search is now available in the free Community Edition, not just the paid Atlas service, making it accessible to more developers.

24:18
🔧

Filtering Self-Recommendations

Demonstrates a practical fix for a common problem: excluding the source document from its own recommendations using a filter field in the search index.

25:27

[00:01] you have built using AI for all this talk about AI and how it's going to replace developers? I still haven't seen enough good examples of building something useful with AI. And no, generating source code doesn't really

[00:14] make the cut. So I thought to myself, why don't I build a recommendation engine? The idea is simple. We take a blog post, generate vector embeddings, and then use vector search to produce the recommendations. And that's exactly

[00:27] what I'm going to show you in today's video where we are going to use MongoDB and their Voyage 4 models for generating the embeddings. So, how can we build a recommendation engine using AI? Let's say that this is a blog post on my

[00:41] website and it's got some content inside. And when somebody scrolls down to the end of the article, I want to be able to say, "Here's another free articles that I think you might find interesting that are adjacent to this

[00:54] topic, but not quite identical." So, we are effectively giving a recommendation of what to take a look at next. And then I thought to myself, how could I build something like this? I'm already using MongoDB which is a document database to

[01:09] store some of the contents for my blog posts. And one thing that MongoDB has is native support for vector search. So what I can do at runtime is take my blog post here and produce what are called vector embeddings. These are just arrays

[01:24] of floatingoint numbers which can be positive or negative and you generate them using an embedding large language model. So we turn the text into an array of numbers. And what we can then do is pass this array of numbers to MongoDB

[01:41] and ask it to perform a vector search where it's going to try to find similar vectors to the one that we are passing in. And how do we get these vectors? of the articles that we have in our database. And then you can extrapolate

[01:56] this idea to any type of similar problem that you're trying to solve. Let's say you've got an e-commerce store and a bunch of product information. You can generate embeddings for those and then based on the current product that

[02:09] somebody is viewing on your website, you can produce an embedding and check the database for similar products to that one and recommend them to the user. The database can return a set of documents to your vector search query. Then you

[02:22] can turn these into a response that you can render on the user interface. So I already mentioned MongoDB but what about the embedding model that we are going to use? I'll be using the Voyage 4 series of models which are built by Voyage AI

[02:36] by MongoDB who is also the sponsor of today's video and what makes these models very interesting to me is that you can use them interchangeably. So explore. The most powerful one being voyage for large. Then we have voyage 4,

[02:50] voyage for light and voyage for nano which is a very lightweight model that you can run on your local machine for what do I mean by using them interchangeably? Well, these models use

[03:04] a shared embedding space. And what this allows you to do is to embed your core data documents in our database with a powerful model like voyage for large. And this is an operation that you would do once. Now you also need to do

[03:17] embeddings at runtime when you are producing queries against your database. And for this you could use a more lightweight model. Let's say void for light. This could give you an optimal trade-off between search precision and

[03:29] the speed of generating the embeddings which can be costly with a larger model. So this is a very powerful concept that these set of models can offer. Now let's see how we could actually use them to build something. I'll be using the

[03:42] voyage for nano model and it's available on hugging face which means we can run it locally. You can check out the docs here to learn more about this specific model and it produces a set of embeddings with a varying number of

[03:55] dimensions from 256 up to 248 dimensions. And you've also got a few examples of how to use this but these are in python and we are net developers. So how can we use this model from our net application? Your first instinct for

[04:11] running this locally might be using Olama. And unfortunately, this specific model isn't Olama compatible. However, there's a conversion for this model that's also available on hugging face which we can run inside of Olama. And

[04:26] I'll show you how we can run all of this easily with Aspire inside of net. Let's jump into Visual Studio where I've got a foundation that implements some functionality that we are going to build upon to implement our recommendation

[04:39] engine using MongoDB and Voyage for Nano. So the API itself is currently empty. It only integrates with Aspire for running the net application. And other than that, there's also a blog service which is going to help us fetch

[04:55] the contents from my website for a specific URL and extract the article and content that we are going to be embedding and storing inside of MongoDB. embedding and storing inside of MongoDB. Now, what do we need to run O Lama using

[05:09] Aspire and the voyage for nano model? So we need to install an additional nougat package. And if you look for Olama, you will find this package here called Community Toolkit Aspire hosting Olama. Let's go ahead and install the latest

[05:24] version. And this will allow us to add Olama as a resource inside of our Aspire app host. So with this Nougat package installed, we can say builder add lama and then give our resource a name. So let's go ahead and store it in a

[05:40] variable. And then a couple of things I recommend is using a data volume so that you don't have to download the model every time you restart the Aspire application. And if you've got a solid GPU, you can call with GPU support. This

[05:52] will help you run your inference faster and generate the embeddings using the GPU instead of the CPU. Then we're going to add our model, which I'm going to call voyage 4. And we can add this using

[06:04] Lama and this helpful method that it has called add hogging face model. So we're going to give our model a name. Let's call it Voyage for Nano. And then we have to specify our model name. And I'm going to use the one which is GGUF

[06:20] compatible. Which means we can run it locally using O Lama. So once we have our model, we're going to reference it from our application. I'm also going to wait for the model to be up and running before starting our net app. And with

[06:33] this we have our Voyage for nano model running locally. Now, in order to be client library that's going to help us interact with the Olama API. So, inside of the recommendations API project, I'm going to install another library and I'm

[06:50] again going to look for Olama and this time I want to install community toolkit aspire. Let's go ahead and add the latest version of this library. And then inside of the program file of the

[07:03] recommendations API, we can say builder addama API client. We have to provide a specify the name of our resource which is voyage for nano. And then this is the

[07:16] key part. We can add this as an embedding generator which is the integration with Microsoft extensions AI. And it lets us use the I embedding generator abstraction to produce our vector embeddings. Then we need to run

[07:29] our database. And I want to run this locally using Docker. And I'm doing this mainly for performance reasons. But we also need to make sure that we run an instance of MongoDB that supports vector search. Now you can always use the

[07:43] search. Now you can always use the MongoDB Atlas cloud service. But if you want to run this locally, you've got a couple of options. One is running the MongoDB community edition server or which is what we are going to do is

[07:55] running the MongoDB Atlas local docker image as a container. If you open up a command prompt you can type in this command docker run then I'm running this in detach mode which is why the D flag is there. I'm exposing the default

[08:09] is there. I'm exposing the default MongoDB port of 27, 2017. I'm giving my container a name and then the image that we are going to run is MongoDB/ MongoDB Atlas local. So I'm going to go ahead and run this. This will start a

[08:23] new container on my local machine and I'll be able to connect to it from my net application using a simple connection string. If we open up Docker Desktop, we can confirm that our MongoDB Atlas local instance is up and running.

[08:36] Now all we have to do is connect to it, store some documents in there, generate start performing vector search. Going back to Visual Studio I want to add one more thing in the Aspire app host and that is a connection string to our

[08:52] MongoDB instance. Let's call it just And I'll say builder add connection string and let's also call it Then I'll say with reference and pass in my connection string. And we're also going to wait for the connection

[09:06] string to become available. Now, how do you actually provide this value at runtime? Well, if we start the application, the app host is going to ask us to enter this value manually or we can provide it as an environment

[09:18] variable. Now, the secure way to do this from Visual Studio would be adding it as already added it here. The environment variable name is connection strings, then And here is the value pointing to our MongoDB instance

[09:33] available on local host. I'm currently not using authentication but obviously in production you would also specify the username and password here. So when we start this our connection string will be available but we also have to use it

[09:46] from our net application. And the core abstraction for interacting with MongoDB is the IM client which I'm going to add as a singleton service by saying builder services add singleton. And let me specify the I client. And then

[10:03] I'm going to pass in a new instance of the client service by saying builder configuration get connection string. And I'm going to look for a connection string called which will be provided by Aspire when we run

[10:16] our application. If you're wondering where this is coming from, well, I already installed the core library that's going to allow me to interact with MongoDB, which is the MongoDB driver nougat package. I added the

[10:29] latest version at the time of recording this video, which was 3.6.0. So, this gives me access to client and now we can finally use it to implement our API endpoints. So, let me add an endpoint here, which I will

[10:43] expose using the post HTTP method. And let's make the route for example embeddings generate. Now we need to provide a request delegate where we're going to implement the logic for this endpoint. And what is it that we want to

[10:56] do in here? We are going to need a couple of services. The first one being our blog service allowing us to fetch the contents of a blog using a URL. Then we're going to need an I embedding generator. And here we want to embed a

[11:09] string value and produce an embedding that contains the individual embeddings as floatingoint numbers. Let's call this the embedding generator. Then we're going to need our client for storing our embeddings inside of

[11:22] MongoDB. And let's also add a logger because it might be useful in case we run into any exceptions. So I'm going to inject an I logger instance and then we can start implementing our endpoint. So the first thing we need is to get access

[11:35] to our MongoDB database by using our client and we can do this by calling the get database method. I'll call my database recommendations and then once I have my database I can get my collection which is like a table in a

[11:51] relational database. So a collection is going to contain our documents and I can say database get collection and the collection type is going to be an article and of course the collection itself will be called articles. Now what

[12:04] is this article class that I'm using here? Well, I already defined it in my project and it just contains a couple of fields that we are going to need to store this document in MongoDB. The identifier that MongoDB will populate

[12:16] when we insert this into the database. the URL to the article that we are generating the embeddings for, the title and the content if that might be useful. Then finally the star of the show, the floatingoint array containing our

[12:29] embeddings for this specific document. Now what I will be embedding is the content of each article and then I'll use the other values for metadata to return something useful to our API callers. So next we're going to need a

[12:42] list of articles and I'm going to create it by newing up a new list. And then how do we actually get all of the articles? Well, there's a file here called sitemap Well, there's a file here called sitemap URLs that contains the URLs for the 180

[12:56] articles that I currently have on my website. And we're going to be pulling all of them one by one, generate the embeddings for them, and then finally store all of them in bulk inside of MongoDB. So I'll use a for each loop and

[13:09] MongoDB. So I'll use a for each loop and we want to loop through file read all lines and we want to pass in the name of our file which is sitemap urls txt. So this is going to give us the individual lines which represent an article URL.

[13:24] The blog service that we injected as a dependency has a method called get title and content async and it conveniently accepts an article URL. Now this is going to return the title and the content of this article. In the

[13:39] implementation here, we are sending a request using an HTTP client getting back the actual HTML content of this page on my website. And then we need to do some parsing to extract the useful content from our HTML document. Finally,

[13:53] we're going to have this as a tubble containing a title and the content. And then we can proceed to generate the embedding. So for this we have our embedding generator which has a generate async method. Now these code completions

[14:06] are kind of killing me because they are hallucinating methods that don't exist. But finally I can pass in the contents and produce a vector embedding. So you can see the type here is an embedding of float and this contains the actual

[14:20] vector that we can store as an array by calling the two array method. Now we don't want to set the identifier for the article but we are going to fill in the other metadata. So once we have this we want to add it to our list and then we

[14:33] can produce to generate the next embedding. Now I want to wrap this in a try catch block in case something goes wrong and we're going to produce a structured log by saying log error and pass in the exception the article URL

[14:47] going to use this for debugging purposes but it will be useful to look into any issues if we run into them to see why we are getting some errors. Now the main culprit here could be generating the vector embeddings as that is the only

[15:01] unstable component depending on the large language model which can have varying output between different API calls. So finally we complete our loop and we've got all of our articles with their respective vector embeddings. So

[15:14] their respective vector embeddings. So what we can then do is say collection insert many async pass in the articles and of course we have to await this. So this is going to do a bulk insert and write all of our documents to MongoDB.

[15:28] And then finally we can say return results. Okay. This will complete our endpoint. Now I want to test this out before we implement the vector search capabilities. So let's go ahead and start our application. You can see the

[15:41] Aspire dashboard here where our O lama container is starting up and it's downloading the voyage for nano model so that it can use it to produce the embeddings. We are getting the actual model from hugging face but we are using

[15:54] a version of voyage for nano that is compatible with Olama. You can see our I take a look in the environment variables, you will see a connection string for Voyage 4 which points to our local OAM instance and the model that we

[16:08] want to use, but also a connection string for our MongoDB instance which points to our local MongoDB atlas. So now we can send a post request to our recommendations API to first produce the respective vector embeddings. I'm going

[16:21] to do that from Postman by just sending a simple post request. And of course, we are going to hit the break point which I added inside of our endpoint. So, we're going to get our database and our collection. If they don't exist on

[16:34] MongoDB, they will be created. And then we're going to proceed to generate the embeddings. Now, I'm going to show you what that looks like for just one article. So, we first fetch this using an HTTP client. You can see the response

[16:47] is 200. Okay. and we've got our HTML document that we are going to now parse to fetch the article content and the title. This step contains some trial and error to figure out the right way to extract the content. But finally, we can

[17:00] proceed to this step which is the crucial one and it produces the set of vector embeddings. Now, this might take a moment for the first time you run it, but eventually you should get a set of vector embeddings which contains a

[17:12] vector embeddings which contains a vector of 1,024 floatingoint numbers that looks something like this. It's important to remember the size of this array because this is the number of dimensions that we can use to perform

[17:24] vector search. This will play a role later when we define the respective going to hit continue and I'm going to wait a couple of minutes because it's of the embeddings as the model that we are using isn't particularly powerful or

[17:39] do the work. Once all of this completes, the documents will be available in MongoDB. So I'm going to jump into MongoDB Compass so that we can take a look at our collection and the documents inside. Inside of MongoDB Compass, which

[17:54] is a nice little UI that lets us view and manage our database, you can connect to our local instance using the same connection string that we used inside of the application. So, we just have to point this to localhost 27, 2017 and set

[18:07] point this to localhost 27, 2017 and set direct connection as true. Or if you password, you can do so in the authentication tab. For my use case, I didn't need to add this. So, I'm just going to connect to the local instance.

[18:21] process completed successfully and we can see our recommendations database inside and the articles collection. So, here's what our documents look like. And they contain the URLs for the individual articles, the title, and then the

[18:35] extracted content and the most important part, the embeddings inside of a floatingoint array. So, this is what we are going to need to perform vector search to be able to produce our recommendations. Now, one key piece of

[18:49] the puzzle that we need is a search index and not just any kind of index. We need a vector search index. So, I'm going to call this the vector index. And have to provide a path to the name of the field that you want to index on. In

[19:04] our case, this field is called embedding. Then the next important thing is the number of dimensions, which if you recall is 1,024. And then lastly, we have to choose the similarity method. that we want to use

[19:18] for our vector comparisons. And you have three of them to choose from. Ukitian, cosine, and dotproduct. I'll use uklidian for this example. And now let's go ahead and create our search index. So it may take a few moments for this to

[19:30] populate. But because we don't have a huge number of documents, this will complete fairly quickly. So now that our index is ready, we can go ahead and use me show you what that's going to look like. We need to expose one more

[19:44] endpoint on our API and this time it's going to be a get endpoint. So let's call this article and we're going to pass in the slug for the article we are looking for as a route parameter and then we're going to say recommendations.

[19:57] Let's define our endpoint body and I want to reuse the free services that we have here along with our route parameter which is a string value containing the URL slot. So then we're going to need the blog service, the embedding

[20:11] generator, and our client. So the process is going to be very similar to what we did previously. But the first thing we need is a URL pointing to the article. And we can get this by saying file read all lines. We have to specify

[20:25] the name of our file, which is sitemap URLs .txt. And then we're going to look URLs .txt. And then we're going to look for the first row that ends with the URL slug we passed in as the parameter. And this will be our article URL. Now, of

[20:38] course, this could be null or empty. So, we have to account for that. And if that is the case, we can just return a 404 not found response. So, I'll say results not found. Then, we can go ahead and fetch our blog. So, we're going to use

[20:52] our blog service to get the title and the content for the respective article URL. And then we're going to generate the embedding that we need to perform a vector search. So we're going to say await embedding generator generate async

[21:06] pass in the content and we've got our embedding array and then this is the fun part where we can utilize MongoDB. I'm going to create a new instance of the vector search options. So let's new up the vector search options. We're looking

[21:20] over our article document and what we can set here is the index name which I'm we just created. And then you have to decide how you want to perform the search. You can do exact search which is the most precise approach but it's also

[21:35] the slowest one. So you have to make a trade-off between speed and performance here. Now if you leave exact as true, the vector search is going to look through the entire index and find the optimal results based on the similarity

[21:47] method that we are using. The other option is leaving this with the default value of false and then using what's called the approximate nearest neighbor search where you pass in a number of candidates that you want to look for

[22:00] when performing the vector search. And the benefit of this is you get somewhat precise results but you get them much faster than when you do exact nearest neighbor search. In our case, we want to get the best possible result. So let's

[22:12] neighbor approach. And then we're going to need our database which is recommendations. and of course our collection and then to get our results we're going to say await collection aggregate and finally we can call the

[22:26] vector search method. So here we have to define a couple of things. First what is the vector search and this is the embeddings collection. Then we have to pass in our query vector which we already have from the step above and I

[22:42] can say embedding vector to array. Then we have an option to limit the number of results that we are returned from the database. And let's say I want to recommend three articles that the reader should take a look at next. So I'm going

[22:55] to specify that. And finally, we can pass in our vector search options. And then I can call to list async to get back the results from the database. So then I'm going to say return results. Okay. And I'm going to return an

[23:08] anonymous object containing the article URL, the title, and then the recommendations, which I'm going to generate by accessing the results and projecting them into an anonymous object that contains the recommended article

[23:22] title and the recommended article URL. Let's call to array here and finalize everything. And now let's see what happens when we call this endpoint. So here's the request that I'm going to send to our API and the slug is for one

[23:38] containerize your net applications without a docker file. So let's see what would be some relevant articles that we could recommend to read after this one. So we send an API request and we land on the breakpoint in our new endpoint where

[23:53] we first try to extract the URL for this article. So in this case, we found it and then we can go ahead and parse the title and the content and of course generate the vector embeddings. So now that we've got our embeddings, we can go

[24:05] ahead and pass them to MongoDB to perform vector search. And what's really awesome is that vector search is now also available in the community edition, whereas it was previously only available inside of MongoDB Atlas. So I think this

[24:18] is a powerful capability that will be very useful in a lot of applications, including my own use case for generating recommendations. So after we perform the free results. And I won't show you what they are because we have a hidden

[24:32] once we take a look at the response. But what you can also see is that this was a very fast operation. And that's all thanks to the index that we have behind the scenes. It helps us implement

[24:44] performant vector search. So I'll press continue and we get back to response in we have here, we will notice that the article that we were reading to put it applications without a docker file article. And the recommendation also

[25:00] contains the same article. So we've got a problem here that we are not filtering And obviously the most similar article to the embedding that we just passed in will be that same exact article. Now the other two articles for net aspire or the

[25:13] C support for single file applications are relevant to our topic. However, we have to see how to filter out the original article. Going back to our MongoDB database, we have to take a second look at our vector search index.

[25:27] So, currently we are only indexing on the embedding column which contains our floatingoint array representing the vector embedding. But we also want to be able to filter on the specific field. So, what I'm going to do is drop this

[25:39] index because the update operation isn't working for some reason. And instead, I'm going to create it again using the same parameter. So let's call this the vector index and then here's the content which is identical to what we had

[25:52] previously with the addition of one more field and you can have a number of these that you will use for filtering. So the type of the field is filter and it's pointing to the title path in the document. So let's go ahead and create

[26:04] this. It's building and in a moment or two it should be ready for use. But now we also have to update our query to filter out based on the title field which is now part of our search index. We can do this inside of the vector

[26:17] search options where we have an option to set the filter and I can say builders and specify my document type which is the article. Then I'll say filter and then where and we want to filter out the articles where the title isn't equal to

[26:33] the title of the current article. We get this value when we fetch the article the content. This should filter out the current article. We could also use the article URL if we wanted to be more precise, but the title is going to be

[26:47] sufficient enough. If you want to learn more about how you can use MongoDB to power your applications, go ahead and take a look at the pinned comment below application again. I'll send another query from Postman. And remember that in

[27:02] the previous example, we got back the original article. So, let's see if this same flow of fetching the article URL, extracting the content, generating the embeddings, and then we're going to initialize our vector search options.

[27:15] And what's different this time is that we are going to filter based on the title column, and exclude the current document. So we're going to get the database, get the collection, send the query off to MongoDB, and we get back a

[27:28] the response is going to look like this time? Well, now there's no longer the original article which is what we wanted and we have the two articles from our previous example and another recommended article which is called using .NET

[27:42] Aspire with the Docker publisher. So now we could go ahead and render these recommendations on the UI and the goal would be keeping the reader on our website. As I said, you can extrapolate this to any other business domain and I

[27:55] gave you an example of how you could use this in an e-commerce setting. If you want to build this recommendation engine yourself, then go ahead and grab the video. And if you want to learn more about MongoDB and what you can do with

[28:09] pinned comment that's going to be right below. And lastly, if you're looking for a beginnerfriendly introduction to vector search with MongoDB Atlas, go ahead and take a look at this video next. If you enjoy this video, hit that

[28:24] like button. Thanks a lot for watching and until next time. And until next and until next time. And until next time, stay awesome.

More from Milan Jovanović

View all

⚡ Saved you 0h 28m reading this? Transcribe any YouTube video for free — no signup needed.