Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
4 changes: 3 additions & 1 deletion snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ toc_landing_pages = [
"/playgrounds",
"/crud-ops",
"/playground-databases",
"/require-playgrounds"
"/require-playgrounds",
"/copilot"
]

[constants]
Expand Down Expand Up @@ -40,6 +41,7 @@ cifs = ":abbr:`CIFS (Common Internet File System)`"
cps = ":abbr:`CPS (Cloud Provider Snapshots)`"
cmk = ":abbr:`CMK (customer master key)`"
compass = "MongoDB Compass"
copilot = "MongoDB Github Copilot Participant"

Choose a reason for hiding this comment

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

There is a capital H in GitHub - we should correct throughout.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

Choose a reason for hiding this comment

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

Thank you!

data-lakes = "Data Lakes"
data-lake = "Data Lake"
datadog = "`Datadog <https://www.datadoghq.com/>`__"
Expand Down
35 changes: 35 additions & 0 deletions source/ai-data-usage.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. vscode-ai-data-usage:

=============================
AI and Data Usage Information
=============================

.. contents:: On this page
:local:
:backlinks: none
:depth: 1

The MongoDB Github Copilot Participant is powered by Generative AI (Gen
AI), and may give inaccurate responses. See our `Generative AI FAQ
<https://dochub.mongodb.org/core/faq-ai-features>`__ for more
information about Gen AI in MongoDB products.

Third Party Providers
---------------------

The MongoDB Github Copilot Participant is powered by `Github Copilot <https://github.com/features/copilot>`__.

How Your Data is Used

Choose a reason for hiding this comment

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

I'd like us to make sure to run this answer by Product legal if we haven't yet. This contains what we normally include but because we get so many questions from customers it's just good to be sure we have covered our bases here. We've been primarily working with Rachael McClure - let me know if you need any assistance in getting a check here. cc @GaurabAryal

---------------------

When you use the MongoDB Github Copilot Participant, the following
information is sent to MongoDB's backend and/or the third party AI

Check failure on line 26 in source/ai-data-usage.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.Avoid] Don't use 'and/or'. Raw Output: {"message": "[MongoDB.Avoid] Don't use 'and/or'.", "location": {"path": "source/ai-data-usage.txt", "range": {"start": {"line": 26, "column": 42}}}, "severity": "ERROR"}

Choose a reason for hiding this comment

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

The 'third party AI provider' here refer distinct to two things:

  1. The LLM API exposed by Copilot itself (we theoretically use the exact same LLM that Copilot uses)
  2. Our docs chatbot API endpoint used by our Docs Chatbot

Choose a reason for hiding this comment

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

Not sure if we need to be that specific, however,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@themantissa What do you think?

Choose a reason for hiding this comment

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

It doesn't really fit the header but I tend to like to over-provide than under so it would be good to note we augment the underlying LLM with our own docs chatbot.

provider:

- The full text of your natural language prompt.
- The schema of the collection you are using,
including database name, collection name, field names, and types.

The information that is sent will not be shared with any other third
parties or stored by the AI provider. We do not send database
connection strings, credentials, or rows/documents from your databases.
141 changes: 141 additions & 0 deletions source/copilot-query.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
.. _vsce-copilot-query:

==============
/query Command
==============

.. default-domain:: mongodb

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

The ``/query`` command assists in generating queries from a natural
language against a connected MongoDB cluster. The |copilot| provides
underlying schema information of the relevant collections to Github
Copilot to generate a response. If you do not specify a collection in
your prompt, the chat prompts you to select a relevant collection.

When the LLM generates a query, you can open the query in a playground
file or run the query directly in your collection.

Examples
~~~~~~~~

Generate a Query
````````````````

Consider the ``users`` collection in the `Mflix Sample Database
<https://www.mongodb.com/docs/atlas/sample-data/sample-mflix/#sample_mflix.users>`__.
Each document in the collection has the following structure:

.. code-block:: javascript
:copyable: false

{
_id: {
"$oid": "59b99db4cfa9a34dcd7885b6"
},
name: "Kayden Washington",
email: "[email protected]",
password: "11222021"
}

Once you connect to the deployment that contains the ``users``
collection, you can ask the Github Copilot chat to generate a query that
finds the document in the ``users`` collection that has the ``name``
value of ``Kayden Washington``.

.. code-block:: javascript
:copyable: false

@MongoDB /query In the sample_mflix database, find a document in the
users collection with the name of Kayden Washington.

The Github Copilot Chat uses the |copilot| to
generate the following query using knowledge of your database schema:

.. code-block:: javascript

use(`sample_mflix`);
db.getCollection('users').findOne({ name: 'Kayden Washington' });

Once the |copilot| generates the query, you can choose to run the query
directly or open the query in a playground.

.. figure:: /images/copilot-query.png
:figwidth: 700px
:alt: Screenshot of copilot generating a query

Build an Aggregation Pipeline
`````````````````````````````

You can also use the |copilot| to build aggregation pipelines. Consider
the ``users`` collection in the `Mflix Sample Database
<https://www.mongodb.com/docs/atlas/sample-data/sample-mflix/#sample_mflix.users>`__.
Each document in the collection has the following structure:

.. code-block:: javascript
:copyable: false

{
_id: {
"$oid": "59b99db4cfa9a34dcd7885b6"
},
name: "Kayden Washington",
email: "[email protected]",
password: "11222021"
}

Once you connect to the deployment that contains the ``users``
collection, you can ask the Github Copilot chat to generate an aggregation pipeline.

.. code-block:: javascript
:copyable: false

@MongoDB /query Generate an aggregation pipeline on the users
collection that first sorts documents alphabetically by name and then
removes the password field from each document.

The |copilot| generates the following aggregation pipeline:

.. code-block:: javascript

use('sample_mflix');
db.getCollection('users').aggregate([
{ $sort: { name: 1 } },
{ $project: { password: 0 } }
]);

Once the |copilot| generates the query, you can choose to run the pipeline
directly or open the pipeline in a playground.

.. figure:: /images/copilot-agg-pipeline.png
:figwidth: 700px
:alt: Screenshot of copilot generating an aggregation pipeline

You can also iteratively build on your aggregation pipeline:

.. code-block:: javascript
:copyable: false

@MongoDB /query Add a stage to my pipeline that adds a username field
to each document containing the user's email without the
email domain.

The |copilot| returns the following aggregation pipeline:

.. code-block:: javascript

use('sample_mflix');
db.getCollection('users').aggregate([
{ $sort: { name: 1 } },
{ $project: { password: 0 } },
{ $addFields: { username: { $arrayElemAt: [{ $split: ["$email", "@"] }, 0] } } }
]);

.. figure:: /images/copilot-agg-pipeline2.png
:figwidth: 700px
:alt: Screenshot of copilot iteratively building on an aggregation pipeline
41 changes: 41 additions & 0 deletions source/copilot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. _vsce-copilot:

==================================
|copilot|
==================================

.. default-domain:: mongodb

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

|vsce-full| includes the |copilot| to assist in using `Github Copilot
<https://github.com/features/copilot>`__ with your MongoDB deployments.
Through Github Copilot's chat feature, users with |vsce| can interact
with their MongoDB clusters and generate code with MongoDB
domain-specific knowledge on top of Github Copilot's LLM. The |copilot
can also answer questions about your database collection schema and
provide links to specific MongoDB documentation.

The |copilot| includes MongoDB-specific
commands to assist in interacting with your deployment.

Commands
--------

/query
~~~~~~

The ``/query`` command assists in generating queries from a natural
language against a connected MongoDB cluster.

.. toctree::
:titlesonly:

/query </copilot-query>
AI & Data Usage </ai-data-usage>


47 changes: 47 additions & 0 deletions source/images/copilot-agg-pipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions source/images/copilot-agg-pipeline2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions source/images/copilot-query.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions source/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Get Started
/connect
/databases-collections
/playgrounds
/copilot
/create-cluster-terraform
/reference
Changelog <https://github.com/mongodb-js/vscode/releases>
Loading