MongoDB Atlas Vector Search integrates ANN search directly into the MongoDB aggregation pipeline. These exercises cover index creation requirements, the $vectorSearch pipeline stage, accessing vectorSearchScore via $meta, pre-filtering on metadata, and the numCandidates vs. limit relationship for recall tuning.
0 / 5 completed
1 / 5
What is required to use MongoDB Atlas Vector Search on a collection?
Atlas Vector Search requires a Vector Search index defined on the collection. The index definition specifies the field containing embeddings, the number of dimensions, and the similarity metric (cosine, euclidean, or dotProduct). Indexes are created via the Atlas UI, CLI, or Admin API and are separate from regular MongoDB search indexes.
2 / 5
Which MongoDB aggregation pipeline stage is used to perform a vector similarity search?
$vectorSearch is the Atlas aggregation stage that performs approximate nearest neighbor search. It accepts the queryVector, path (field name), numCandidates (ANN candidates to consider), and limit (results to return). It must be the first stage in the pipeline.
3 / 5
What does vectorSearchScore represent in Atlas Vector Search results, and how do you access it?
The vectorSearchScore is the similarity score (higher = more similar) returned by the $vectorSearch stage. It's accessed using { $meta: 'vectorSearchScore' } in a subsequent $project stage: { score: { $meta: 'vectorSearchScore' } }. The score range depends on the similarity metric used.
4 / 5
How does Atlas Vector Search support pre-filtering results by metadata?
Atlas Vector Search supports pre-filtering directly in the $vectorSearch stage via the filter field, which accepts MQL-like operators on indexed scalar fields. Pre-filtering happens during ANN candidate selection, not after, ensuring the specified limit returns results that both match the filter and are semantically similar.
5 / 5
A developer uses numCandidates: 150 with limit: 10 in $vectorSearch. What is the relationship between these values?
numCandidates sets how many candidates the ANN algorithm considers internally before scoring and ranking — higher values improve recall at the cost of latency. limit is the final number of results returned after scoring the candidates. MongoDB recommends numCandidates be at least 10x limit for good recall.