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 8 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"
120 changes: 120 additions & 0 deletions source/atlas-vector-search.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.. _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 vector search on your data stored in
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
You can use {+vector-search+} to perform vector search on your data stored in
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).

By using Atlas as a vector database, you can seamlessly index vector data along
with your other data in Atlas. This allows you to filter on fields in your
collection and perform vector search queries against vector data. You can also
combine vector search with full-text search queries to return the most relevant
results for your use case. You can integrate {+vector-search+} with popular AI
frameworks and services to implement vector search in your applications.
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: I would include only one paragraph of background text. The link to the Atlas Vector Search will be useful for those who want to learn more. I would keep the first paragraph and remove the 2nd paragraph entirely, or integrate some of the content from the 2nd paragraph into the first if you think necessary.


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 :ref:`node-indexes` section in the
Copy link
Collaborator

Choose a reason for hiding this comment

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

I: There is currently no documentation for creating AVS indexes in the Node.js docs on the linked page. Something like this section in the Go docs should be created: https://www.mongodb.com/docs/drivers/go/current/fundamentals/indexes/#atlas-search-and-atlas-vector-search-indexes.
You can add it as part of this ticket or create another ticket in the CC epic if it is more convenient (I normally lean towards creating another ticket)!

If you choose to create another ticket for adding the section to the indexes page, I would link to this section on creating AVS indexes in the Atlas docs: https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/#create-an-atlas-vector-search-index

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'll create a new ticket!

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can drop a link here when you do!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indexes guide. To learn more about vector embeddings, see
:atlas:`How to Index Vector Embeddings for Vector Search
</atlas-search/field-types/knn-vector/>` in the Atlas documentation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I: It seems like this page has deprecated info now. This is the relevant embedding page for Atlas Vector Search: https://www.mongodb.com/docs/atlas/atlas-vector-search/create-embeddings/


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


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 data and a vector search index that covers that field.
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 data and a vector search index that covers that field.
vector embeddings and a vector search index that covers that field.

S: I think using "embeddings" is the more specific term.


.. tip::

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

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

Choose a reason for hiding this comment

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

S: I would remove this tip, as creating vector embeddings was discussed in the intro. This is all you need to do to configure the collection.


This example shows how to build an aggregation pipeline that uses the
``$vectorSearch`` stage to perform an exact vector search on the
``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. The aggregation
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: This info is a bit crowded here. I would include this info in a Sample Data section, like on this Go page: https://www.mongodb.com/docs/drivers/go/current/fundamentals/atlas-vector-search/#sample-data

pipeline searches for documents that include text in the ``plot`` field that is
semantically related to the term "time travel". The ``queryVector`` field in 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
:atlas:`Get Started with Atlas </getting-started>` guide. The aggregation
pipeline searches for documents that include text in the ``plot`` field that is
semantically related to the term "time travel". The ``queryVector`` field in the
:atlas:`Get Started with Atlas </getting-started>` guide. 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

S: Reword for clarity

``$vectorSearch`` pipeline is the vector representation of your query.

.. literalinclude:: /includes/aggregation/atlas-vector-search-example.js
:language: javascript
Copy link
Collaborator

Choose a reason for hiding this comment

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


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

- Compare vector embeddings of the search term against vector embeddings of movie plots in
the ``plot_embedding`` field of the ``sample_mflix.embedded_movies`` 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
- Compare vector embeddings of the search term against vector embeddings of movie plots in
the ``plot_embedding`` field of the ``sample_mflix.embedded_movies`` collection.
- Search for the specified term in the``plot_embedding`` field

S: Don't think using the technical explanation is necessary here, as it was already explained above.


- Consider up to the 150 most similar movie plots and return the top 10 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
- Consider up to the 150 most similar movie plots and return the top 10 results.
- Set the number of nearest neighbors used in the search to 150 by using the ``numCandidates`` option
- Return 10 documents

S: Would explicitly include what numCandidates does, as it's not clear from the option name


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.


- 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.

S: Monospace is helpful here, so users know they can reference that variable in the code when reading your explanation.


.. tip:: {+language+} Vector Search Examples

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

Choose a reason for hiding this comment

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

S: I would include this is in the Additional Information section and use the format for that section.


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

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