Create a MongoDB Atlas Vector Search index and run a $vectorSearch aggregation

domain: mongodb.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In Atlas UI, navigate to your collection, open 'Atlas Search', and click 'Create Search Index' — select 'Vector Search' as the index type.
  2. Define the index JSON with your vector field, number of dimensions, and similarity metric (cosine, euclidean, or dotProduct), then create the index.
  3. Insert documents with an embedding field containing a BSON array of numbers matching the declared dimension count.
  4. Run a `$vectorSearch` aggregation stage: `{ $vectorSearch: { index: 'your_index', path: 'embedding', queryVector: [...], numCandidates: 100, limit: 10 } }`.
  5. Add a `$project` stage after `$vectorSearch` to include the `score` field via `{ score: { $meta: 'vectorSearchScore' } }` and return relevant document fields.

Known gotchas

Related routes

Define a MongoDB Atlas Search index with a custom Lucene analyzer and run a faceted search aggregation
www.mongodb.com/docs/atlas/atlas-search · 6 steps · unrated
Run hybrid search combining vector and full-text results in MongoDB Atlas using $rankFusion
mongodb.com · 5 steps · unrated
Qdrant: create a collection and perform a vector search
qdrant.tech/documentation · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans