![]() |
VOOZH | about |
Vector databases have become a revolutionary technology for applications that use artificial intelligence, especially in fields such as semantic search, similarity-based recommendation systems, and natural language understanding. At first glance, they seem very different from traditional databases designed for structured transactional workloads.
MongoDB now bridges these worlds: It offers all the traditional document storage and ACID transaction capabilities, but also provides native vector search capabilities thanks to its Atlas Vector Search engine. Here, we will see how MongoDB can be both a traditional structured database and a vector database. Rather than presenting vector databases and relational/document databases as competing entities, this article shows how both models solve different needs and why MongoDB is able to handle both within a single platform.
You will learn the conceptual differences between structured data storage and vector-based similarity search, how they work, and what embeddings are; when to rely on vector search instead of queries and indexes; and how MongoDB enables these capabilities using a unified document model.
For decades, databases have been divided into different design categories. Traditional relational databases, such as MySQL and PostgreSQL, focused on structured tables, strong typing, and transactional workloads. NoSQL databases such as MongoDB, on the other hand, were created with the idea of offering flexibility, scalability, and semi-structured data modelling.
The advent of large language models (LLMs) and modern deep learning systems has introduced a new category of database design technology: vector databases. These systems store the embeddings produced by machine learning models and allow for similarity searches between vectors to retrieve documents, phrases, or multimedia objects based on meaning rather than exact matches.
The challenge for architects and developers today is this:
MongoDB's answer to this problem is unique. MongoDB remains a traditional online transaction processing (OLTP)-oriented document store, offering schema flexibility, ACID transactions, horizontal scalability, and secondary indexes. At the same time, it now integrates Atlas Vector Search, which enables high-performance similarity searches on numerical embedding fields without the need to operate an additional vector database such as Pinecone, Weaviate, or Milvus.
In other words, MongoDB functions both as a traditional data store and as a vector-enabled AI database, depending on how developers structure and query their data. We discuss this duality below.
Traditional databases provide structure and consistency. They are perfect when data needs to be well defined, consistent, and consistent within itself.
MongoDB, although not a relational database, fits into this category when used as a document database. It stores documents, ensures data and content validation, supports transactions, and exposes consistent data query models.
Traditional database workloads typically include:
MongoDB is efficient in contexts such as:
MongoDB's BSON format offers developers a flexible document model that aligns perfectly with the JSON format, making schema evolution significantly easier than with relational databases.
Despite the flexibility of the schema, MongoDB still offers indexing tools and features for deterministic queries. When searching using the value "customerId":2453, MongoDB's query engine retrieves results using B-tree-based indexes maintained by the WiredTiger storage engine.
This deterministic record retrieval model is the hallmark of traditional database systems: A query is matched against records, not patterns or meanings.
Vector databases have a completely different way of retrieving information. Instead of searching for values with perfect matches, they store vectors, which are nothing more than large numerical arrays that represent the meaning of text, audio, images, or objects.
Vectors transform real-world signals into mathematical positions within a multidimensional space. Searching becomes a geometric problem rather than a comparison of values.
If two user queries produce vectors that are close to each other in vector space, the results are considered similar, even if the text does not contain overlapping keywords.
For example, searching for the text "troubleshooting error 500" can retrieve documents titled "guide to debugging internal server errors" even if the keyword "500" does not appear.
This capability leads us to real-world use cases such as:
Vector search is fundamental to the architecture of artificial intelligence systems because traditional indexing cannot match human semantic reasoning. While a traditional database searches for words in fields, a vector database searches for meaning.
What makes MongoDB a real game-changer is its dual identity. Developers can decide whether MongoDB should behave as a document database or a vector database, depending on how they design their documents and queries.
As a traditional document database, it can handle:
As a vector database, it can handle:
Instead of managing and operating two different systems, one for structured transactional operations and one for AI search, MongoDB offers a unique and consolidated architecture. This advantage is crucial for enterprises (and others) that want to implement applications based on generative artificial intelligence without building their data stack from scratch and incurring double management costs.
The document model naturally supports embedding arrays. For example, a `product` document in MongoDB may contain:
{
"productId": 2402,
"name": "Wireless Bluetooth Headset",
"tags": ["audio", "wireless", "music"],
"description": "Noise cancelling bluetooth headphone",
"vector": [0.014, -0.22, 1.04, ... ]
}
This single document can participate in:
It is not easy to have these features within a classic vector database: Developers would have to maintain external metadata layers or integrate external databases to store non-vector attributes. MongoDB avoids all this by providing a unified object data structure.
MongoDB Atlas Vector Search performs approximate nearest neighbour searches using specialised vector indexes. Developers can easily write queries such as the following:
db.products.aggregate([
{
$vectorSearch: {
index: "vector_index",
knn: {
vector: queryEmbedding,
path: "vector",
k: 5
}
}
}
])
The result of this query includes documents whose vectors are closest to the query vector in terms of multidimensional distance.
In MongoDB Atlas Vector Search, the similarity metric is configured in the index (fields.similarity field) and can be Euclidean, cosine, or dot product.
In practice:
The choice of metric also determines how the $vectorSearch score is normalised to 0–1.
Traditional queries cannot calculate similarity rankings because they do not contain a geometric abstraction. Vector indexes transform this problem into an efficient search algorithm.
Clearly, not all applications benefit from vectors. Traditional databases are still the best choice for all applications where it is not necessary to understand the meaning or content of the data.
For example, vector databases are not recommended for the following use cases:
These workflows are based on structured indexing rather than semantic comparison. Embeddings would add no value.
This distinction clarifies a common misconception: Vector search does not replace structured queries, but is a complementary query method.
Many AI-based production workloads combine both filtering and similarity search. In these cases, it is usually necessary to link multiple different database products together. One possible example is filtering by product category and then sorting the results based on semantic similarity to the user's search query.
In MongoDB, this can be done in a single pipeline:
db.products.aggregate([
{
$vectorSearch: {
index: "vector_index",
path: "vector",
queryVector: embedding,
limit: 20,
filter: { category: "electronics" }
}
},
{ $project: { _id: 1, score: { $meta: "vectorSearchScore" } } }
])
This hybrid retrieval capability combines structured filtering logic with embedding proximity scoring logic.
Vector indexing requires a considerable amount of computation. For this reason, MongoDB uses special multidimensional indexing structures such as Hierarchical Navigable Small World (HNSW) graphs.
Developers should keep in mind:
From a performance perspective, MongoDB offers stable k-NN search speed, suitable for enterprise-scale implementations. Traditional indexes, such as B-trees, geospatial indexes, and hash indexes, continue to be used to serve transactional workloads.
MongoDB is not a universal solution: In some cases, adoption and management can be challenging. There are cases where specialised vector engines can perform better than MongoDB-for example, in the case of:
Pure vector databases are often also optimised for distributed deep compute.
Vector databases enable the creation of retrieval-augmented generation (RAG) architectures, which are the driving force behind modern LLM applications.
A RAG pipeline requires:
MongoDB's ability to store documents and embeddings together avoids the complexity of dual-storage pipelines, and its aggregation framework can handle pre-processing transformations.
The result: Adopting generative artificial intelligence becomes easier.
The rise of vector databases doesn't mean the end of traditional database tech. Instead, it expands the database world with new ways to search and reason.
MongoDB is at the centre of this evolution. It offers the power and reliability you'd expect from a traditional database, but also integrates modern vector search features that enable AI-driven discovery.
Developers creating generative AI applications, recommendation engines, and semantic search layers no longer need to use specialised vector databases by default. In many cases, MongoDB offers a simpler, unified, production-ready platform that handles both structured queries and similarity-based retrieval.
The choice is no longer between vector databases or traditional databases. The future database landscape increasingly combines both characteristics as AI and transactional applications grow closer together.
In many cases, yes, especially when you have an app with structured and similarity queries.
Yes, through Atlas Search.
Yes-MongoDB supports hybrid search natively.
Yes, using HNSW indexes.
It depends on the Atlas tier. MongoDB Vector Search supports embeddings that are less than and equal to 8,192 dimensions in length.
MongoDB is one of the best platforms for RAG, thanks to unified storage.
No. Always store vectors together with metadata for better performance.
Yes, vector search is integrated into Atlas Search indexes.