Skip to content

Commit 26a17b7

Browse files
committed
DOCSP-43494-copilot--docs-command
1 parent 2b2bf55 commit 26a17b7

File tree

2 files changed

+110
-10
lines changed

2 files changed

+110
-10
lines changed

source/copilot-docs.txt

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,52 @@ knowledgeable of the latest MongoDB Documentation and uses the
1818
MongoDB Docs Chatbot API to link users to information in addition to
1919
the textual response.
2020

21-
Examples
22-
~~~~~~~~
21+
Example
22+
~~~~~~~
2323

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

27-
You can ask the |copilot| to link you to relevant MongoDB Documentation.
28-
For example, consider the following prompt in the GitHub Copilot chat :
27+
.. code-block:: javascript
28+
:copyable: false
29+
30+
@MongoDB /docs how do I create an index?
31+
32+
The chat first provides with the following links to MongoDB Documentation:
33+
34+
- `Create an Index <https://www.mongodb.com/docs/manual/core/indexes/create-index/>`__
35+
- `createIndexes <https://mongodb.com/docs/manual/reference/command/createIndexes/>`__
36+
- `Getting Started with MongoDB and Java - CRUD Operations Tutorial <https://www.mongodb.com/developer/languages/java/java-setup-crud-operations>`__
37+
- `db.collection.createIndex() <https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/>`__
38+
39+
The |copilot| also returns a textual response with information about
40+
creating an index:
2941

3042
.. code-block:: javascript
3143
:copyable: false
3244

33-
@MongoDB /docs can you link me to documentation on creating an index?
45+
To create an index in MongoDB, you can use the createIndex() method
46+
in the MongoDB Shell or the equivalent method for your specific
47+
driver. Here are examples for different programming languages:
48+
49+
MongoDB Shell
50+
51+
db.collection.createIndex({ <key and index type specification> }, { <options> })
3452

35-
The chat responds with the following pages:
53+
C#
3654

37-
- G
55+
collection.CreateIndex(IndexKeys<collection>.<key and index type
56+
specification>, <options>);
57+
58+
...
3859

60+
Indexes support efficient execution of queries in MongoDB. If your
61+
application is repeatedly running queries on the same fields,
62+
creating an index on those fields can significantly improve
63+
performance. However, keep in mind that while indexes improve query
64+
performance, they can negatively impact write operations due to the
65+
additional overhead of maintaining the index.
3966

40-
67+
.. figure:: /images/copilot-docs.png
68+
:figwidth: 700px
69+
:alt: Screenshot of copilot providing information on creating an index

source/images/copilot-docs.png

Lines changed: 71 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)