Skip to content

Commit a3df17f

Browse files
committed
DOCSP-43495 Jason edits
1 parent 55dfc3e commit a3df17f

File tree

1 file changed

+48
-15
lines changed

1 file changed

+48
-15
lines changed

source/copilot-schema.txt

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,79 @@
1212
:depth: 1
1313

1414
The ``/schema`` command provides information about your collection
15-
schema. The |copilot| accesses your connected MongoDB deployment to
16-
provide schema information in the Copilot generated response.
15+
schema by accessing your connected MongoDB deployment.
1716

1817
Examples
1918
--------
2019

2120
Provide a Sample Document
2221
~~~~~~~~~~~~~~~~~~~~~~~~~
2322

24-
Consider the ``users`` collection in the `Mflix Sample Database
23+
This example uses the ``users`` collection in the `Mflix Sample Database
2524
<https://www.mongodb.com/docs/atlas/sample-data/sample-mflix/#sample_mflix.users>`__.
25+
Each document in the collection has the following structure:
26+
27+
.. code-block:: none
28+
:copyable: false
29+
30+
{
31+
"_id": {
32+
"$oid": "59b99db4cfa9a34dcd7885b6"
33+
},
34+
"name": "Ned Stark",
35+
"email": "[email protected]",
36+
"password": "$2b$12$UREFwsRUoyF0CRqGNK0LzO0HM/jLhgUCNNIJ9RJAqMUQ74crlJ1Vu"
37+
}
38+
39+
2640
If you are connected to a MongoDB deployment that contains this
27-
collection, you can ask the |copilot| to provide a sample document:
41+
collection, you can ask the |copilot| to show the schema of your collection:
2842

2943
.. code-block:: none
3044
:copyable: false
3145

32-
@MongoDB /schema Can you show a sample document from the
46+
@MongoDB /schema @MongoDB /schema Can you show the schema for the
3347
sample_mflix.users collection?
3448

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

3751
.. code-block:: none
3852
:copyable: false
3953

40-
Sure, here is a sample document from the sample_mflix.users
41-
collection:
42-
54+
The schema for the sample_mflix.users collection, based on 100
55+
sampled documents, is as follows:
56+
4357
{
4458
"_id": {
45-
"$oid": "5f8473b823bca94021aa1c45"
59+
"type": "ObjectId",
60+
"probability": 1
61+
},
62+
"email": {
63+
"type": "String",
64+
"probability": 1
4665
},
47-
"email": "[email protected]",
48-
"name": "John Doe",
49-
"password": "password123",
50-
"preferences": {}
66+
"name": {
67+
"type": "String",
68+
"probability": 1
69+
},
70+
"password": {
71+
"type": "String",
72+
"probability": 1
73+
},
74+
"preferences": {
75+
"type": ["Document", "Undefined"],
76+
"probability": 0.01
77+
}
5178
}
5279

53-
Once Copilot generates the response, you can open the JSON output to see
54-
more information.
80+
Key Points:
81+
82+
- Fields _id, email, name, and password appear in all documents with
83+
a probability of 1.
84+
- The preferences field is mostly undefined but occasionally contains
85+
a document (1% probability).
86+
87+
After Copilot generates the response, you can open the output in JSON format.
5588

5689
.. figure:: /images/copilot-schema.png
5790
:figwidth: 600px

0 commit comments

Comments
 (0)