You can configure MongoDB Vector Search to automatically generate and manage vector embeddings for the text data in your Atlas cluster. When you enable Automated Embedding, MongoDB Vector Search automatically generates embeddings using the specified Voyage AI embedding model at index-time for the specified text field in your collection and at query-time for the text string in your query.
Automated Embedding simplifies the process of building semantic search. You don't need to generate, store, or manage vector embeddings yourself. Atlas handles embedding generation, updates, and querying natively.
Note
You must enable auto-scaling with a maximum instance size of M30 or higher
for M10 and M20 clusters to use Automated Embedding. For all other
cluster tiers, Automated Embedding is enabled by default.
You can deploy MongoDB Vector Search and enable intelligent, AI-powered semantic search on your text data through Automated Embedding in MongoDB Vector Search indexes. MongoDB's Automated Embedding capabilities transform the traditionally complex process of vector search implementation into a single-step solution. Instead of managing separate embedding infrastructure, model selection, and integration code, you can now implement semantic search through simple field configuration.
When you configure MongoDB Vector Search indexes, it automatically generates vector embeddings for text data in your collection, using your selection of a state-of-the-art Voyage AI embedding model, keeps the embeddings in sync as your data changes, and also supports use of natural language text queries. These vector embeddings capture meaningful relationships in your data and allow for searching based on intent rather than keywords.
Enable and Use Automated Embedding
To enable Automated Embedding, you create a MongoDB Vector Search index using the autoEmbed
type. The autoEmbed type specifies the field for which you want to enable
Automated Embedding and the embedding model that you want to use. You can also
include one or more fields to pre-filter your data using the filter type.
1 { 2 "fields": [ 3 { 4 "type": "autoEmbed", 5 "modality": "text", 6 "path": "<field-to-index>", 7 "model": "<embedding-model>" 8 }, 9 { 10 "type": "filter", 11 "path": "<field-to-index>" 12 }, 13 ... 14 ] 15 }
To learn more about the index syntax and fields, see How to Index Fields for Vector Search.
MongoDB Vector Search automatically generates embeddings for existing and new documents that you insert or update.
Once you've created the index, you can run your queries. MongoDB Vector Search automatically
generates embeddings for your query text using the same embedding model that you
specified in the index. You can optionally specify a different embedding model
using the model option in the $vectorSearch pipeline stage, but
the specified embedding model must be compatible with the embedding model used at
index-time.
1 [ 2 { 3 "$vectorSearch": { 4 "index": "<index-name>", 5 "path": "<field-to-index>", 6 "query": "<query-text>", 7 "model": "<embedding-model>" 8 } 9 }, 10 { 11 "$project": { 12 "_id": 0, 13 "<field-to-index>": 1, 14 "score": { "$meta": "vectorSearchScore" } 15 } 16 } 17 ]
To learn more, see Run Vector Search Queries.
Note
The feature is available for MongoDB Search and MongoDB Vector Search deployments using Docker, tarball, or a package manager and for deployments using the MongoDB Controllers for Kubernetes Operator with MongoDB 8.2 or later Community Edition. Automated Embedding functionality is not yet available for MongoDB Enterprise Edition.
With a simple configuration change, you can enable semantic search, RAG, and memory for AI Agents, without writing embedding code,
managing model infrastructure, or handling vector pipelines. That is, when
deploying the MongoDB Community Edition with the MongoDB Search
and Vector Search process, mongot,
you can provide the Voyage AI API keys
to use for generating embeddings, ideally one for indexing operations and
another for query operations from different projects.
After deployment:
From your collection, choose the text field for which you want to enable the semantic search.
From the list of available embedding models, choose an embedding model.
In your MongoDB Vector Search index definition, configure Automated Embedding using the
autoEmbedtype.
To learn more about configuring MongoDB Vector Search index for Automated Embedding, see How to Index Fields for Vector Search.
MongoDB Vector Search automatically generates embeddings for existing and new documents that you insert or update by using the API keys that you specified while initializing MongoDB Community Edition.
For querying, use the query.text option in the $vectorSearch
pipeline stage. MongoDB Vector Search generates embeddings for the text query using the
same embedding model in the index definition. You can specify a different
embedding model using the model option in the $vectorSearch
pipeline stage, but the specified embedding model must be compatible with
the embedding model used at index-time. MongoDB Vector Search uses the query API key that
you provided during MongoDB Community initialization to generate the
embeddings at query-time. To learn more, see Run Vector Search Queries.
You incur charges for generating embeddings using the API keys. To learn more, see Manage Billing.
To automate embeddings and run a sample query, see MongoDB Vector Search Quick Start.
Voyage AI API Keys
While you can use a single API key for generating embeddings at index-time and at query-time, we recommend that you use separate API keys to avoid query operations from negatively impacting indexing operations.
You can generate API keys in the following ways:
(Recommended) Using your Atlas account, which allows you to manage your Voyage AI embedding model API key from the Atlas UI.
To learn more about generating and managing API keys including configuring the rate limits (which is a combination of TPM and RPM) and monitoring API key usage, see Model API Keys.
To learn more about managing the API keys created from Voyage AI, see API Key.
After creating the keys, you must specify the keys you want to use for
automated embedding when configuring mongot during deployment with MongoDB Community Edition. MongoDB Vector Search
uses the Voyage AI API key that you provided during deployment of
mongot to automatically generate embeddings for your data at index-
and for your query text at query-time.
Embeddings Storage
Automated embedding indexes generate vector embeddings asynchronously and persist to your MongoDB cluster on a separate reserve database. Each Automated Embedding index has exactly one corresponding generated embeddings collection. The generated embeddings collection is stored in a dedicated internal database on the same cluster.
To learn more, see Generated Embeddings Collection.
Available Models
MongoDB Vector Search integrates with Voyage AI's state-of-the-art embedding models, each optimized for specific use-case:
Embedding Model | Description | Price Per 1M Tokens |
|---|---|---|
| Optimized for high-volume, cost-sensitive applications. | $0.02 |
| (Recommended) Balanced performance for general text search. | $0.06 |
| Maximum accuracy for complex semantic relationships. | $0.12 |
| Specialized for code search and technical documentation. | $0.18 |
To learn more, see Models for Automated Embedding.
Key Concepts
- embedding model
Embedding models are algorithms that convert data into vector embeddings that capture your data's semantic, or underlying, meaning. These vectors enable vector search.
To learn more about the embedding models for Automated Embedding, see Available Models.
- vector embeddings
A vector embedding is an array of numbers, with each dimension representing a different feature or attribute of your data. Vectors can be used to represent any type of data, from text, images, and video to unstructured data. You create vector embeddings by passing your data through an embedding model, and you can store these embeddings in a database that supports vector embeddings like MongoDB.
To learn more about the embeddings storage for Automated Embedding, see Generated Embeddings Collection.
- tokens
In the context of embedding models and LLMs, tokens are the fundamental units of text, such as words, subwords, or characters, that the model processes to create embeddings or generate text. Tokens are how you are billed for usage of embedding models and LLMs.
To learn more about tokens for Automated Embedding, see Manage Billing for Automated Embedding.
- rate limits
Rate limits are restrictions imposed by API providers on the number of requests a user can make within a specific time frame, often measured in tokens per minute (TPM) or requests per minute (RPM). These limits ensure fair usage, prevent abuse, and maintain the stability and performance of the service for all users.
To learn more about rate limits for Automated Embedding, see Rate Limits.
- quantization
Quantization reduces the precision of vector embeddings to decrease memory and storage usage, with trade-offs in search accuracy. For Automated Embedding, MongoDB Vector Search supports the following quantization types:
Quantization TypeDescriptionfloatStores the vector embeddings as 32-bit float values.
scalarReduces each vector dimension from 32-bit float to 8-bit integer.
binaryReduces each vector dimension to a single bit and rescores the top results.
binaryNoRescoreReduces each vector dimension to a single bit without rescoring.
To learn more about the quantization for Automated Embedding, see About Quantization.
- number of dimensions
The number of dimensions specifies the length of the embedding vector for each document (how many numbers are in the array). Higher dimensions capture more semantic detail and generally improve retrieval accuracy, but increase storage and compute costs (index size, RAM usage, and sometimes latency).
To learn more, see
numCandidatesSelection.- similarity
The similarity function is used to measure the similarity between two vectors or the closeness of a query vector to the vectors in the index. MongoDB Vector Search supports the following similarity functions:
cosine- measures similarity based on the angle between vectors.dotProduct- measures similarity likecosine, but takes into account the magnitude of the vector. We recommend this similarity function for full-fidelity orscalarquantization.euclidean- measures the distance between ends of vectors. We recommend this similarity function forbinaryorbinaryNoRescorequantization, where vectors are compressed and distance in Hamming or Euclidean space is the right signal.
To learn more about the similarity functions for Automated Embedding, see About the Similarity Functions.