Text vs Vector Search in MongoDB Atlas

In this post, we’re gonna run a side-by-side search spin-off in MongoDB Atlas:

The goal isn’t to “replace” text search. It’s to experience, hands-on, why vector search is different.

  • Keyword search answers: “Which documents contain these words?” (BM25-style ranking).
  • Vector search answers: “Which documents are most similar in meaning?” (closest vectors).

To keep this truly “Hello World” and fast to reproduce, we’ll use Atlas’s sample dataset (sample_mflix) which includes an embedded_movies collection designed for vector search experiments.


Prerequisites

Accounts + cloud setup

  • A MongoDB Atlas account and a project.
  • An Atlas cluster you can connect to (Free Tier / Flex is fine for this tutorial).

Local tools

  • Git (to clone the repo / commit your changes)
  • mongosh (MongoDB Shell) or MongoDB Compass

Atlas data + indexes we’ll create

  • Load Atlas Sample Dataset → sample_mflix database, including embedded_movies
  • We will create:
    • A Search (text) index for keyword search using the text operator (BM25 scoring by default).
    • A Vector Search index so $vectorSearch can run.

Optional (nice to haves)

  • Node.js (if you want a tiny “demo app” wrapper around the queries later).
  • Atlas CLI (not required for this, but handy once you automate)