vai logo
vai
Use CasesShared SpaceDocs
Get Started
Pipeline
MongoDB Atlas
Embeddings
Vector Search
Local Embeddings
Hybrid Search
Docker

Vector Search Developer Day (VAI Edition)

The complete MongoDB Developer Day vector search workshop reimagined as a VAI CLI workflow. Use it as a backup during the Vector Search: Beginner to Pro lab or afterward to reinforce concepts: set up local MongoDB, install the CLI, generate embeddings with voyage-4-nano, create a vector index, and run semantic search — end to end from the command line.

MongoDB Atlas
View Source TapeOpen Docs
Prerequisites

Docker installed (for local MongoDB Atlas) or access to a MongoDB Atlas cluster.

Node.js >= 18 installed.

VAI CLI installed globally: `npm install -g voyageai-cli`.

For query commands (Step 5+), a VOYAGE_API_KEY is needed — free tier available at voyageai.com. Embedding and ingestion run entirely locally with nano.

Environment Setup
Copy all

Choose your MongoDB setup. Both options work identically with the VAI CLI — the Docker local image includes full Atlas Vector Search support.

1

Start MongoDB Atlas Local

The mongodb-atlas-local Docker image provides a single-node MongoDB instance with full Atlas Search and Vector Search support — no cloud account needed.

$docker run -d --name mongodb-atlas-local -p 27017:27017 mongodb/mongodb-atlas-local:latest
$sleep 5
$mongosh --eval "db.runCommand({ ping: 1 })"
2

Install & Configure VAI CLI

Install the CLI globally and point it at your local MongoDB instance.

$npm install -g voyageai-cli
$vai config set mongodb-uri "mongodb://localhost:27017"
$vai --version
3

Download Nano Model

voyage-4-nano is an open-weight embedding model (~700 MB). It runs locally and generates 1024-dim vectors compatible with all Voyage 4 models.

$vai nano setup
$vai models --type embedding
Lab companion

This demo mirrors the full MongoDB Developer Day vector search workshop. Use it as a backup reference during the lab (if you get stuck or want to see the CLI equivalent) or afterward to reinforce concepts with a single-terminal workflow.

Open Vector Search: Beginner to Pro
Lab step → VAI equivalent
Lab sectionVAI commandNote
20 Dev EnvironmentJupyter setupdocker run -d --name mongodb-atlas-local -p 27017:27017 mongodb/mongodb-atlas-local:latestSame local MongoDB. VAI uses the terminal instead of notebooks.
30 Import DataImport books into mongodb_genai_devday_vs.booksvai ingest --file books.jsonl --db mongodb_genai_devday_vs --collection books ...Lab uses Python + preloaded data. VAI ingests from JSONL and embeds in one step.
40 Perform Vector SearchStep 3: Generate embeddingsvai embed "..." --local --dimensions 1024Lab uses voyage-multimodal-3 (images). VAI uses voyage-4-nano (text, local). Same 1024-dim space.
40 Perform Vector SearchStep 4: Add embeddings to datavai ingest ... --localCombined with import. Batch-embeds each document and writes to Atlas.
40 Perform Vector SearchStep 5: Create vector indexvai index create --db mongodb_genai_devday_vs --collection books --field embedding --dimensions 1024Same $vectorSearch index definition. VAI creates it via CLI.
40 Perform Vector SearchStep 6: Run vector search queriesvai query "A man wearing a golden crown" --db mongodb_genai_devday_vs --collection books --model voyage-4-liteSame $vectorSearch aggregation. VAI embeds the query, runs the pipeline, and prints results.
50 OptimizingPre-filteringvai index create ... (supports filter fields)See Under the Hood for the filter field in the index definition. vai query supports pre-filters.
60 Other TechniquesHybrid searchSee mongoQuery in Under the HoodThe $rankFusion pipeline combines vector and full-text search. VAI exposes this in advanced workflows.

The lab teaches the concepts (embeddings, $vectorSearch, pre-filters, hybrid). This VAI demo gives you the same workflow in a reproducible CLI form. Run both to reinforce the mental model: Python for exploration, VAI for automation and demos.

Under the hood

See the exact VAI command, the matching Voyage AI layer, and the MongoDB query shape behind the demo.

vai query "A man wearing a golden crown" --db mongodb_genai_devday_vs --collection books --model voyage-4-lite

This demo mirrors the full MongoDB Developer Day vector search workshop end-to-end. Part 1 sets up the environment: a local MongoDB Atlas instance via Docker, the VAI CLI, and voyage-4-nano for local embeddings. Part 2 runs the workshop: ingest, index, search, and rerank. No cloud account needed for the database — everything runs locally except the lightweight query API call.

Share or copy this demo

Keep it lightweight. The prepared text stays behind the buttons.

Open canonical URL

Share

Copy

LinkedIn opens the share dialog and copies the prepared text so you can paste it in quickly.

Exact commands

The full walkthrough is included here so anyone can replay the demo exactly as published.

$docker run -d --name mongodb-atlas-local -p 27017:27017 mongodb/mongodb-atlas-local:latest
$sleep 5 && mongosh --eval "db.runCommand({ ping: 1 })"
$npm install -g voyageai-cli
$vai config set mongodb-uri "mongodb://localhost:27017"
$vai nano setup
$vai embed "Puppy Preschool: Raising Your Puppy Right" --local --dimensions 1024
$vai ingest --file books.jsonl --db mongodb_genai_devday_vs --collection books --field embedding --text-field title --local --dimensions 1024 --batch-size 10
$vai index create --db mongodb_genai_devday_vs --collection books --field embedding --dimensions 1024 --similarity cosine
$vai query "A man wearing a golden crown" --db mongodb_genai_devday_vs --collection books --model voyage-4-lite --no-rerank
$vai query "A boy and the ocean" --db mongodb_genai_devday_vs --collection books --model voyage-4-lite
$docker stop mongodb-atlas-local && docker rm mongodb-atlas-local

Related demos

More shareable workflows from the same VAI demo library.

Pipeline
MongoDB Atlas
Featured
End-to-End Atlas Pipeline

Run the full workflow in one command: create sample docs, chunk them, embed them, store them in Atlas, and auto-create the vector index.

Atlas
API key

VAI command

vai pipeline /tmp/vai-demo-docs/ --db vai_demo --collection knowledge --create-index

Show Under the Hood

Prerequisites

A valid VOYAGE_API_KEY is set in the environment.

View DemoSource
Retrieval
Reranking
Featured
Two-Stage Retrieval With Reranking

Walk through the classic retrieval stack: embed the query, run Atlas vector search, rerank the candidates, then compare the result to a vector-only pass.

Atlas
API key

VAI command

vai query 'how does vector search work?' --db vai_demo --collection knowledge --model voyage-4-lite

Show Under the Hood

Prerequisites

A valid VOYAGE_API_KEY is set in the environment.

Getting Started
Embeddings
Featured
What Is an Embedding?

Start from first principles: generate a Voyage embedding, inspect its shape, and compare full-size versus Matryoshka-reduced vectors.

API key

VAI command

vai embed 'MongoDB Atlas makes vector search production-ready'

Show Under the Hood

Prerequisites

A valid VOYAGE_API_KEY is set in the environment.