Vector Databases, Explained for MERN Developers
If you can write a MongoDB query, you can understand a vector database. The difference is what you search by: instead of matching exact field values, you match by meaning. That single shift is what makes semantic search, RAG, and recommendation systems possible — and it fits into a MERN stack more naturally than most engineers expect.
What a vector actually is
An embedding model turns a piece of text into a long array of numbers — a coordinate in a high-dimensional space where similar meanings sit close together. "Cancel my subscription" and "how do I end my plan" land near each other even though they share no keywords. The vector is just that coordinate. A vector database is built to find the nearest ones, fast.
Similarity search vs. exact query
A normal query asks "where status equals active." A vector query asks "what is closest to this point." The first is exact and binary; the second is ranked and fuzzy. You are no longer filtering records — you are sorting all of them by relevance to a meaning and taking the top few. That is the entire mechanism behind retrieval.
// $vectorSearch: nearest neighbours by meaning
const hits = await Docs.aggregate([
{ $vectorSearch: {
index: "embedding_index",
queryVector: await embed(query),
path: "embedding",
numCandidates: 200,
limit: 5,
} },
]);Atlas vector search vs. a dedicated store
For a MERN team, the pragmatic answer is usually to keep your vectors next to your documents — MongoDB Atlas's vector search means one database, one query language, no extra system to operate. Reach for a dedicated store only when scale, specialized indexing, or extreme query volume justify the added operational weight. Most products never do.
A vector database is not exotic infrastructure. It is a WHERE clause that sorts by meaning instead of matching by value.
Embeddings power the search; the next post, Embeddings 101, goes deeper on generating and storing them.