Skip to content

DOCSP-48385 Make Atlas Vector Search page #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ driver-short = "Node.js driver"
mdb-server = "MongoDB Server"
min-node-version = "v16.20.1"
stable-api = "Stable API"
vector-search = "Atlas Vector Search"
130 changes: 130 additions & 0 deletions source/atlas-vector-search.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
.. _node-atlas-vector-search:

===================
Atlas Vector Search
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Atlas Vector Search
Run an Atlas Vector Search Query

S: Too make the title a bit more descriptive

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning towards keeping the title the same for consistency: this page is the one after the Atlas Search page already merged in: 9e31836 which is just called Atlas Search, and in our other docs that have avs pages they are all just titled atlas vector search https://www.mongodb.com/docs/drivers/kotlin/coroutine/current/fundamentals/builders/vector-search/, https://www.mongodb.com/docs/drivers/csharp/current/fundamentals/atlas-vector-search/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Titles should be between 30-60 characters (maintenance wiki). I'm going to add a check to the PR Checklist next week to make sure we check for title length!
Also, this page aligns with the content on the "Run Vector Search Queries" page of the Atlas docs, so I think it makes sense to have a similar title. Let me know what you think!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good, I'm good with following the title guidelines!

===================

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: code example, semantic, nearest

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

Overview
--------

In this guide, you can learn how to use the :atlas:`Atlas Vector Search
</atlas-vector-search/vector-search-overview/>` feature
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this guide, you can learn how to use the :atlas:`Atlas Vector Search
</atlas-vector-search/vector-search-overview/>` feature
In this guide, you can learn how to use the Atlas Vector Search feature

Remove the link here since there is a "learn more" at bottom of the section

in the {+driver-short+}.

You can use {+vector-search+} to perform a vector search on your data stored in
Atlas. Vector search allows you to query your data based on semantic meaning
rather than just keyword matches, which helps you retrieve more relevant search
results. It enables your AI-powered applications to support use cases such as
semantic search, hybrid search, and generative search, including
Retrieval-Augmented Generation (RAG).

To learn more about {+vector-search+}, see the :atlas:`{+vector-search+}
</atlas-vector-search/vector-search-overview/>` guide in the MongoDB Atlas
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</atlas-vector-search/vector-search-overview/>` guide in the MongoDB Atlas
</atlas-vector-search/vector-search-overview/>` guides in the MongoDB Atlas

documentation.

.. important:: Feature Compatibility

To learn what versions of MongoDB Atlas support this feature, see
:atlas:`Limitations </atlas-vector-search/vector-search-stage/#limitations>`
in the MongoDB Atlas documentation.

Perform a Vector Search
-----------------------

To use this feature, you must create a vector search index and index your
vector embeddings. To learn about how to programmatically create a
vector search index, see the :atlas:`Create an Atlas Vector Search index
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vector search index, see the :atlas:`Create an Atlas Vector Search index
vector search index, see the :atlas:`Create an Atlas Vector Search Index

Capitalize title

</atlas-vector-search/vector-search-type/#create-an-atlas-vector-search-index>` section in the
Atlas documentation. To learn more about vector embeddings, see
:atlas:`How to Create Vector Embeddings
</atlas-vector-search/create-embeddings/>` in the Atlas documentation.

After you create a vector search index on your vector embeddings, you
can reference this index in your pipeline stage, as shown in the
following section.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
following section.
following example.

Since Sample Data is now the next section


Sample Data
-----------
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-----------
~~~~~~~~~~~

Should be a subheading


The example on this page shows how to build an aggregation pipeline that uses the
``$vectorSearch`` stage to perform an exact vector search on the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
``$vectorSearch`` stage to perform an exact vector search on the
``$vectorSearch`` stage to perform a vector search on the

The example is an ANN rather than an ENN search. Here's the documentation: https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#fields
I think it makes sense to mention the type of search at the bottom rather than here, so I'll leave a comment in the search specs!

``sample_mflix.embedded_movies`` collection in the :atlas:`Atlas sample datasets
</sample-data>`.

To learn how to create a free MongoDB Atlas cluster and load the sample datasets, see the
:atlas:`Get Started with Atlas </getting-started>` guide.

Vector Search Example
~~~~~~~~~~~~~~~~~~~~~

You can perform a vector search query by using the ``$vectorSearch`` stage
in an :ref:`aggregation pipeline <node-aggregation>`. To perform a vector
search on a collection, you must first have a collection with a field that contains
vector embeddings and a vector search index that covers that field.

The aggregation pipeline searches the ``plot`` field of each document in the collection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The aggregation pipeline searches the ``plot`` field of each document in the collection
In the following example, the aggregation pipeline searches the ``plot`` field of each document in the collection

for text semantically related to the term "time travel". The ``queryVector`` field in the
``$vectorSearch`` pipeline is the vector representation of your query.

.. io-code-block::
:copyable: true

.. input:: /includes/aggregation/atlas-vector-search-example.js
:language: javascript
:dedent:

.. output::
:language: json
:visible: false

'{"plot":"A reporter, learning of time travelers visiting 20th century disasters, tries to change the history they know by averting upcoming disasters.","title":"Thrill Seekers","score":0.7892671227455139}'
'{"plot":"At the age of 21, Tim discovers he can travel in time and change what happens and has happened in his own life. His decision to make his world a better place by getting a girlfriend turns out not to be as easy as you might think.","title":"About Time","score":0.7843604683876038}'
'{"plot":"Hoping to alter the events of the past, a 19th century inventor instead travels 800,000 years into the future, where he finds humankind divided into two warring races.","title":"The Time Machine","score":0.7801066637039185}'
`{"plot":"After using his mother's newly built time machine, Dolf gets stuck involuntary in the year 1212. He ends up in a children's crusade where he confronts his new friends with modern techniques...","title":"Crusade in Jeans","score":0.7789170742034912}`
'{"plot":"An officer for a security agency that regulates time travel, must fend for his life against a shady politician who has a tie to his past.","title":"Timecop","score":0.7771612405776978}'
'{"plot":"A time-travel experiment in which a robot probe is sent from the year 2073 to the year 1973 goes terribly wrong thrusting one of the project scientists, a man named Nicholas Sinclair into a...","title":"A.P.E.X.","score":0.7730885744094849}'
`{"plot":"Agent J travels in time to M.I.B.'s early days in 1969 to stop an alien from assassinating his friend Agent K and changing history.","title":"Men in Black 3","score":0.7712380886077881}`
'{"plot":"Bound by a shared destiny, a teen bursting with scientific curiosity and a former boy-genius inventor embark on a mission to unearth the secrets of a place somewhere in time and space that exists in their collective memory.","title":"Tomorrowland","score":0.7669923901557922}'
'{"plot":"With the help of his uncle, a man travels to the future to try and bring his girlfriend back to life.","title":"Love Story 2050","score":0.7649372816085815}'
'{"plot":"A dimension-traveling wizard gets stuck in the 21st century because cell-phone radiation interferes with his magic. With his home world on the brink of war, he seeks help from a jaded ...","title":"The Portal","score":0.7640786170959473}'

This query uses the ``$vectorSearch`` stage to:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Perform an Approximate Nearest Neighbor (ANN) vector search

Include the type of search

- Search for the specified term in the ``plot_embedding`` field

- Set the number of nearest neighbors used in the search to 150 by using the ``numCandidates`` option

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Return 10 documents by using the ``limit`` option

S: Add a description of what limit does

It uses the ``$project`` stage to:

- Only include the movie ``plot`` and ``title`` fields in the results.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Only include the movie ``plot`` and ``title`` fields in the results.
- Only include the movie ``plot`` and ``title`` fields in the results

S: Be consistent with period use. I would consider these fragments, so it doesn't need a period.


- Add a ``score`` field to show the relevance of each result to the search term.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Add a ``score`` field to show the relevance of each result to the search term.
- Add a ``score`` field to show the relevance of each result to the search term

Same as above


Additional Information
----------------------

To find more tutorials on using the {+driver-short+} to perform Atlas
Vector Searches, see the :atlas:`Atlas Vector Search tutorials </atlas-vector-search/tutorials/>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To find more tutorials on using the {+driver-short+} to perform Atlas
Vector Searches, see the :atlas:`Atlas Vector Search tutorials </atlas-vector-search/tutorials/>`
To find more Atlas Vector Search tutorials for the {+driver-short+}, see the :atlas:`Atlas Vector Search Tutorials </atlas-vector-search/tutorials/>`

S: Reword and capitalize tutorials

in the Atlas documentation.

To learn more about Atlas Vector Search, see :atlas:`Atlas Vector Search </atlas-vector-search/>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To learn more about Atlas Vector Search, see :atlas:`Atlas Vector Search </atlas-vector-search/>`
To learn more about Atlas Vector Search, see the :atlas:`Atlas Vector Search </atlas-vector-search/>` guides

in the Atlas documentation.

API Documentation
~~~~~~~~~~~~~~~~~

To learn more about the ``aggregate()`` method, see the
`API documentation <{+api+}/classes/Collection.html#aggregate>`__.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To learn more about the ``aggregate()`` method, see the
`API documentation <{+api+}/classes/Collection.html#aggregate>`__.
To learn more about the ``aggregate()`` method, see `aggregate() <{+api+}/classes/Collection.html#aggregate>`__ in the API documentation.

S: Be specific in your hypertext links

Loading