Skip to content
63 changes: 63 additions & 0 deletions source/copilot-schema.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.. _vsce-copilot-schema:

===============
/schema Command
===============

.. default-domain:: mongodb

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

The ``/schema`` command provides information about your collection
schema. The |copilot| accesses your connected MongoDB deployment to
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider rewrite in form "To XXX, the YYY."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated this section to simplify!

provide schema information in the Copilot generated response.

Examples
--------

Provide a Sample Document
~~~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider rewrite to not use just one nested heading.

Also, we typically require the use of numbered steps for examples now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done! Because this is a UI example instead of a code example, there is only 1 step (asking the copilot chat) so I left out numbers


Consider the ``users`` collection in the `Mflix Sample Database
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rewrite this to not use "Consider" because what is reader being asked to consider?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

<https://www.mongodb.com/docs/atlas/sample-data/sample-mflix/#sample_mflix.users>`__.
If you are connected to a MongoDB deployment that contains this
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: What about readers who don't have that sample? I checked that page, and it doesn't have an actual command to create the collection if they don't have it.

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 added a sample document to illustrate the collection schema. Because this is a UI example as opposed to a code example, I would recommend using the sample database to ensure consistency over having the user be able to replicate the exact example environment

collection, you can ask the |copilot| to provide a sample document:

.. code-block:: none
:copyable: false

@MongoDB /schema Can you show a sample document from the
sample_mflix.users collection?

GitHub Copilot uses the |copilot| to generate the following response:

.. code-block:: none
:copyable: false

Sure, here is a sample document from the sample_mflix.users
collection:

{
Copy link
Contributor

Choose a reason for hiding this comment

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

I checked the Atlas samples page, and it shows the sample doc as:

{

"_id": {
"$oid": "59b99db4cfa9a34dcd7885b6"
},
"name": "Ned Stark",
"email": "[email protected]",
"password": "$2b$12$UREFwsRUoyF0CRqGNK0LzO0HM/jLhgUCNNIJ9RJAqMUQ74crlJ1Vu"
}

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 used this document to illustrate the collection schema!

"_id": {
"$oid": "5f8473b823bca94021aa1c45"
},
"email": "[email protected]",
"name": "John Doe",
"password": "password123",
"preferences": {}
}

Once Copilot generates the response, you can open the JSON output to see
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider "After", not "Once".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

more information.

.. figure:: /images/copilot-schema.png
:figwidth: 600px
:alt: Screenshot of copilot providing a sample document from a collection.





7 changes: 7 additions & 0 deletions source/copilot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ Commands
The ``/query`` command assists in generating queries from a natural
language against a connected MongoDB cluster.

:ref:`/query <vsce-copilot-schema>`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``schema`` command provides schema information about collections in
your connected deployment.

.. toctree::
:titlesonly:

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


47 changes: 47 additions & 0 deletions source/images/copilot-schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading