Skip to content

Commit

Permalink
DOCSP-43494-copilot--docs-command
Browse files Browse the repository at this point in the history
  • Loading branch information
ltran-mdb2 committed Oct 1, 2024
1 parent 2b2bf55 commit 26a17b7
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 10 deletions.
49 changes: 39 additions & 10 deletions source/copilot-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,52 @@ knowledgeable of the latest MongoDB Documentation and uses the
MongoDB Docs Chatbot API to link users to information in addition to
the textual response.

Examples
~~~~~~~~
Example
~~~~~~~

Create an Index
~~~~~~~~~~~~~~~
Consider the following prompt that asks for information on creating an
index in the GitHub Copilot chat:

You can ask the |copilot| to link you to relevant MongoDB Documentation.
For example, consider the following prompt in the GitHub Copilot chat :
.. code-block:: javascript
:copyable: false

@MongoDB /docs how do I create an index?

The chat first provides with the following links to MongoDB Documentation:

- `Create an Index <https://www.mongodb.com/docs/manual/core/indexes/create-index/>`__
- `createIndexes <https://mongodb.com/docs/manual/reference/command/createIndexes/>`__
- `Getting Started with MongoDB and Java - CRUD Operations Tutorial <https://www.mongodb.com/developer/languages/java/java-setup-crud-operations>`__
- `db.collection.createIndex() <https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/>`__

The |copilot| also returns a textual response with information about
creating an index:

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

@MongoDB /docs can you link me to documentation on creating an index?
To create an index in MongoDB, you can use the createIndex() method
in the MongoDB Shell or the equivalent method for your specific
driver. Here are examples for different programming languages:

MongoDB Shell

db.collection.createIndex({ <key and index type specification> }, { <options> })

The chat responds with the following pages:
C#

- G
collection.CreateIndex(IndexKeys<collection>.<key and index type
specification>, <options>);

...

Indexes support efficient execution of queries in MongoDB. If your
application is repeatedly running queries on the same fields,
creating an index on those fields can significantly improve
performance. However, keep in mind that while indexes improve query

Check failure on line 63 in source/copilot-docs.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.ConciseTerms] 'remember' is preferred over 'keep in mind'. Raw Output: {"message": "[MongoDB.ConciseTerms] 'remember' is preferred over 'keep in mind'.", "location": {"path": "source/copilot-docs.txt", "range": {"start": {"line": 63, "column": 26}}}, "severity": "ERROR"}
performance, they can negatively impact write operations due to the
additional overhead of maintaining the index.

Check failure on line 65 in source/copilot-docs.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.ConciseTerms] 'more' is preferred over 'additional'. Raw Output: {"message": "[MongoDB.ConciseTerms] 'more' is preferred over 'additional'.", "location": {"path": "source/copilot-docs.txt", "range": {"start": {"line": 65, "column": 4}}}, "severity": "ERROR"}


.. figure:: /images/copilot-docs.png
:figwidth: 700px
:alt: Screenshot of copilot providing information on creating an index
71 changes: 71 additions & 0 deletions source/images/copilot-docs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 26a17b7

Please sign in to comment.