Skip to content

Commit 275910f

Browse files
ianf-mongodbAnemyalenakhineika
authored
DOCSP-33192 Compass Generative AI Querying Content (#557)
* DOCS-16333 Stage GAI TOC (#545) * * DOCSP-32900-Prompt-Your-First-Query (#546) * DOCSP-32900-Prompt-Your-First-Query * DOCSP-32901 Prompt your First GAI Aggregation (#554) * DOCSP-32901 Prompt your First GAI Aggregation * DOCSP-32898 Enable Natural Language Querying (#551) * DOCSP-32898 Enable Natural Language Querying * DOCSP-33167 Compass GAI Stub Page (#553) * DOCSP-33167 Compass GAI Stub Page * DOCSP-33190 Update Compass Landing Page with GAI (#556) * DOCSP-33190 Update Compass Landing Page with GAI * DOCSP-33192 Compass Generative AI Querying Content * Apply suggestions from code review Co-authored-by: Rhys <[email protected]> * JO Feedback * * * add public preview to banner * * * * * * * * * * * Apply suggestions from code review Co-authored-by: Alena Khineika <[email protected]> * * * * * SO Feedback * * * * * * * * * * * * * * * * * * * * * generate button casing --------- Co-authored-by: Rhys <[email protected]> Co-authored-by: Alena Khineika <[email protected]>
1 parent e3393c1 commit 275910f

10 files changed

+500
-4
lines changed

snooty.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ toc_landing_pages = [
1818
"/connect/favorite-connections/import-export",
1919
"/instance",
2020
"/config-file",
21-
"/query/filter",
21+
"/query/filter",
22+
"/query-with-natural-language/query-with-natural-language",
2223
"/query/queries",
2324
"/documents",
2425
"/schema",
@@ -48,6 +49,23 @@ value = """
4849
blog post.
4950
"""
5051

52+
[[banners]]
53+
targets = [
54+
"query-with-natural-language/enable-natural-language-querying.txt",
55+
"query-with-natural-language/prompt-natural-language-query.txt",
56+
"query-with-natural-language/prompt-natural-language-aggregation.txt",
57+
"query-with-natural-language/query-with-natural-language.txt"
58+
]
59+
variant = "tip"
60+
value = """
61+
The MongoDB Compass natural language querying feature is currently \
62+
available as a **Public Preview** offering. The product, its features, \
63+
and the corresponding documentation may change during the Preview stage. \
64+
This feature is on a rolling release schedule. As a result, some \
65+
users may temporarily have functionality \
66+
that other users do not. \
67+
"""
68+
5169
[substitutions]
5270
atlas = "MongoDB Atlas"
5371
compass = "MongoDB Compass"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
You can optionally provide feedback by clicking the :icon-fa5:`thumbs-up`
2+
or :icon-fa5:`thumbs-down` icon by the :guilabel:`Natural Language Query Bar`
3+
and provide details on your experience.
4+
5+
Your feedback **is not** used to train any AI models.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
When you query your data using natural language in Compass, the text of
2+
your prompts and details about your MongoDB schemas are sent to
3+
Microsoft and OpenAI for processing. Your data is not stored on any
4+
third party storage systems or used to train AI models.
5+
6+
This software uses generative artificial intelligence. It is
7+
experimental and may give inaccurate results. Your use of this software
8+
is subject to MongoDB's:
9+
10+
- `Terms of Use <https://www.mongodb.com/legal/terms-of-use>`_
11+
- `Acceptable Use Policy <https://www.mongodb.com/legal/acceptable-use-policy>`_
12+
- `Privacy Policy <https://www.mongodb.com/legal/privacy-policy>`_

source/index.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ Explore some of the tasks Compass can help you accomplish, such as importing and
6464

6565
.. step:: Query your data
6666

67-
Write ad-hoc queries to filter your data. Explore trends and commonalities in your collections.
67+
Write ad-hoc queries or generate queries with the help of AI
68+
to filter your data. Explore trends and commonalities in
69+
your collections.
6870

69-
:ref:`To learn more, see Query Your Data<query-bar-filter>`
71+
To learn more, see:
72+
73+
- :ref:`Query Your Data<query-bar-filter>`
74+
- :ref:`Query with Natural Language<query-natural-language>`
7075

7176
.. image:: /images/tabs/query-your-data.png
7277
:alt: MongoDB Compass collection query image
@@ -163,4 +168,4 @@ Expand your knowledge of MongoDB by using Compass with other MongoDB products.
163168
/faq
164169
/learn-more
165170
/release-notes
166-
/submit-feedback
171+
/submit-feedback

source/manage-data.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Interact with Your Data
5454
/views
5555
/documents
5656
/query/filter
57+
/query-with-natural-language/query-with-natural-language
5758
/indexes
5859
/schema
5960
/manage-data/performance-insights
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
.. _enable-natural-language-querying:
2+
3+
================================
4+
Enable Natural Language Querying
5+
================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
14+
You can enable Compass natural language querying by toggling the
15+
:guilabel:`Use Generative AI` setting. Natural language queries can
16+
be a helpful starting point and assist you in learning to write MongoDB
17+
queries.
18+
19+
About this Task
20+
---------------
21+
22+
To enable natural language querying in Compass, follow the steps below.
23+
Alternatively, you can enable natural language querying by clicking the
24+
:guilabel:`Log in to Atlas to enable` button within the
25+
:guilabel:`Use natural language to generate queries and pipelines` modal.
26+
You can display this modal on Compass versions 1.4 or later when
27+
you click the :guilabel:`Generate query` or
28+
:guilabel:`Generate aggregation` button on the query bar.
29+
30+
Before you Begin
31+
----------------
32+
33+
To enable the generation of queries and aggregations in Compass,
34+
you must:
35+
36+
- Sign into Atlas. For details on how to get a free Atlas
37+
account and deploy a free M0 cluster, see :ref:`atlas-getting-started`.
38+
39+
- Have Compass version 1.4 or later installed. For instructions on
40+
downloading and installing the latest version, see :ref:`download-install`.
41+
42+
Steps
43+
-----
44+
45+
.. procedure::
46+
:style: connected
47+
48+
.. step:: Open settings
49+
50+
.. list-table::
51+
:header-rows: 1
52+
:widths: 30 50 20
53+
54+
* - Operating System
55+
- Description
56+
- Keyboard Shortcut
57+
58+
* - Windows / Linux
59+
- In the top menu bar, click :guilabel:`Edit`.
60+
- ``Ctrl`` + ``,``
61+
62+
* - macOS
63+
- In the top menu bar, click :guilabel:`MongoDB Compass`.
64+
- ``⌘`` + ``,``
65+
66+
.. step:: Connect to your Atlas account
67+
68+
a. Select :guilabel:`Feature preview`.
69+
#. Click :guilabel:`Log in with Atlas`.
70+
71+
A web browser displays the
72+
`Atlas login page <https://account.mongodb.com/account/login>`_.
73+
74+
#. Complete the login procedure.
75+
76+
Once completed a :guilabel:`Logged in with Atlas account`
77+
message displays.
78+
79+
.. step:: Enable the generative AI feature
80+
81+
a. The :guilabel:`Data Processing Agreement` displays.
82+
#. Read the :guilabel:`Data Processing Agreement`.
83+
#. Click :guilabel:`Agree and continue`.
84+
#. Click :guilabel:`Save`.
85+
86+
Next Steps
87+
----------
88+
89+
:ref:`prompt-natural-language-query`
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
.. _prompt-natural-language-agg:
2+
3+
=====================================
4+
Prompt a Natural Language Aggregation
5+
=====================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
14+
You can use MongoDB Compass to generate aggregation queries using natural
15+
language. Compass uses AI to generate aggregations based on prompts
16+
you provide. Querying with natural language can be a helpful starting
17+
point and assist you in learning to write MongoDB queries.
18+
19+
About this Task
20+
---------------
21+
22+
.. note::
23+
24+
.. include:: /includes/fact-natural-language-query.rst
25+
26+
- You can also provide natural language prompts on the
27+
:ref:`documents tab <prompt-natural-language-query>`.
28+
29+
- This page uses the :ref:`sample_mflix.movies <sample-mflix>`
30+
collection from the Atlas sample dataset.
31+
32+
Before you Begin
33+
----------------
34+
35+
You must :ref:`enable natural language querying in Compass<enable-natural-language-querying>`.
36+
37+
Steps
38+
-----
39+
40+
.. procedure::
41+
:style: connected
42+
43+
.. step:: Navigate to the :guilabel:`Natural Language Query Bar`
44+
45+
a. Select the :guilabel:`Aggregations` tab.
46+
#. Click the :guilabel:`Generate aggregation` button.
47+
48+
The :guilabel:`Natural Language Query Bar` displays.
49+
50+
.. step:: Type a question about your collection
51+
52+
Type a natural language prompt for your collection into the query
53+
bar. Aggregation pipeline prompts usually have an aggregation verb
54+
such as count, average, or sum with logical conditions. For
55+
example: ``How many movies have more than 3 writers
56+
in the writers array?``
57+
58+
a. Press enter or click the :guilabel:`Generate aggregation` button.
59+
#. An aggregation pipeline populates in the :guilabel:`Pipeline`
60+
bar. You can scroll down to see the syntax of each stage.
61+
62+
.. step:: Run the aggregation
63+
64+
a. Before running the query, make sure to thoroughly review the
65+
syntax of each stage. Ensure the returned pipeline has the
66+
fields and stages that match your desired use case.
67+
68+
.. warning::
69+
70+
Aggregation pipelines can contain operators such as
71+
:pipeline:`$merge` and :pipeline:`$out` that can
72+
modify your collection's data.
73+
74+
b. Press enter or click the :guilabel:`Run` button to execute
75+
the pipeline.
76+
77+
The results populate in the aggregations view.
78+
79+
.. tip::
80+
81+
.. include:: /includes/fact-natural-language-feedback.rst
82+
83+
Example
84+
-------
85+
86+
Below are examples of prompts to help you understand expected results
87+
when using natural language prompts for aggregation.
88+
89+
.. list-table::
90+
:header-rows: 1
91+
:widths: 40 60
92+
93+
* - Prompt
94+
- Response
95+
96+
* - ``Count the movies that have a release year of 1999``
97+
-
98+
.. code-block:: json
99+
:copyable: false
100+
101+
[
102+
{
103+
$match: {
104+
year: 1999
105+
},
106+
},
107+
{
108+
$count: "total_movies",
109+
}
110+
]
111+
112+
* - ``Which comedy genre movie has the most awards?``
113+
-
114+
.. code-block:: json
115+
:copyable: false
116+
117+
[
118+
{
119+
$match: {
120+
genres: "Comedy"
121+
}
122+
},
123+
{
124+
$sort: {
125+
"awards.wins": -1,
126+
"awards.nominations": -1
127+
}
128+
},
129+
{
130+
$limit: 1
131+
},
132+
{
133+
$project: {
134+
_id: 0,
135+
title: 1,
136+
"awards.wins": 1,
137+
"awards.nominations": 1
138+
}
139+
}
140+
]
141+
142+
* - ``How many movies have a imdb.rating > 4?``
143+
-
144+
.. code-block:: json
145+
:copyable: false
146+
147+
[
148+
{
149+
$match: {
150+
"imdb.rating": { $gt: 4 }
151+
}
152+
},
153+
{
154+
$group: {
155+
_id: null,
156+
count: { $sum: 1 }
157+
}
158+
}
159+
]
160+
161+
Next Steps
162+
----------
163+
164+
:ref:`prompt-natural-language-query`
165+
166+
Learn More
167+
----------
168+
169+
:ref:`query-natural-language`

0 commit comments

Comments
 (0)