You’ve got data. Lots of it. Text, videos, images, the world’s longest CSV file, apparently — but how do you actually find it in your database?
One powerful method is to use vector search. Let’s break it down.
To start with the basics, vectors are numerical representations of unstructured data, things like text and images. An embedding model converts data into an array of floating-point numbers, known as dimensions. Each dimension represents some feature of the original content. Add hundreds or thousands of dimensions together, and suddenly computers can compare meaning the same way we might compare concepts.
Here's an example: “video games” and “television” would have similar numbers because they're both things on a screen, while "video games" and "bananas" would be very different. When you plot these vectors in space, similar things cluster together—all the media in one area, all the food in another.
So, how do you actually create these vectors for your data? You'll use an embedding model—services like Voyage AI that specialize in converting text, images, or other content into these numerical vectors. You send your data to the model, and it sends back the embedding.
MongoDB stores those vector embeddings alongside your documents, making it easy to index and search for them later.
Let’s put it into practice: Imagine you’re exploring a database of movies and want to find films based on their themes or plotlines—not just keywords. Maybe you’re looking for a rom-com where everyone falls in love after arguing adorably for 90 minutes.
To make that kind of query work, we first turn your search text into a vector using the same embedding model we used for your documents. That gives us a query embedding that lives in the same semantic space as your data.
Then we pass that vector into the $vectorSearch stage. The Atlas database compares your query embedding to all the indexed embeddings and returns the closest matches based on meaning—even if none of those movies use the exact words you typed.
You can also add pre-filters, such as lexical prefilters, to narrow your search before running it. For example, you might filter “movies after 2010” and then apply semantic similarity on top. It’s faster, cheaper, and often more accurate to compare only the vectors in the filtered subset.
Vector Search makes semantic search intuitive—letting you query your data based on meaning, not just matching text. Learn more about how it works on MongoDB and earn your skill badge at the link in the description!