Skip to content

Commit 3f724c4

Browse files
jeff-allen-mongoAnthony Sansoneatsansone
authored
(DOCSP-13673, DOCSP-13899, DOCSP-13900) Added edit doc feature (mongodb#40)
Co-authored-by: Anthony Sansone <[email protected]> Co-authored-by: Anthony Sansone <[email protected]>
1 parent 95f679b commit 3f724c4

File tree

5 files changed

+56
-42
lines changed

5 files changed

+56
-42
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ data-lakes = "Data Lakes"
3636
data-lake = "Data Lake"
3737
datadog = "`Datadog <https://www.datadoghq.com/>`__"
3838
dns = ":abbr:`DNS (Domain Name System)`"
39+
ejson = ":abbr:`EJSON (Extended Javascript Object Notation)`"
3940
Epoch-time-ms = "Timestamp in the number of milliseconds that have elapsed since the `UNIX epoch <https://en.wikipedia.org/wiki/Unix_time?oldid=828172017>`__"
4041
epoch-time-ms = "timestamp in the number of milliseconds that have elapsed since the `UNIX epoch <https://en.wikipedia.org/wiki/Unix_time?oldid=828172017>`__"
4142
Epoch-time = "Timestamp in the number of seconds that have elapsed since the `UNIX epoch <https://en.wikipedia.org/wiki/Unix_time?oldid=828172017>`__"

source/databases-collections.txt

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Navigate Your Data
1717
Once you :ref:`connect to your deployment <vsce-connect>` using |vsce|,
1818
use the left navigation to:
1919

20-
- Explore your databases, collections, read-only views, and documents.
20+
- Explore your databases, collections, read-only views, and documents.
2121

2222
- Create new databases and collections.
2323

@@ -31,40 +31,39 @@ use the left navigation to:
3131

3232
.. include:: /includes/fact-required-roles.rst
3333

34-
Databases and Collections
35-
-------------------------
34+
View Databases and Collections
35+
------------------------------
3636

37-
When you expand an active connection, |vsce| shows the databases in that
38-
deployment. Click a database to view the collections it contains.
37+
When you expand an active connection, |vsce| shows the databases in
38+
that deployment.
3939

40-
Click a collection to view its documents, schema, and indexes.
40+
- Click the name of a database to view the collections it contains.
41+
- Click the name of a collection to view its documents, schema, and
42+
indexes.
43+
44+
.. include:: /includes/admonitions/close-all-docs-on-exit.rst
4145

4246
View Collection Documents and Schema
4347
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4448

49+
When you expand a collection, |vsce| displays the number of documents
50+
next to the :guilabel:Documents label in the navigation panel.
51+
4552
Documents
4653
``````````
4754

48-
When you expand a collection, |vsce| displays that collection's
49-
document count next to the :guilabel:`Documents` label in the
50-
navigation panel.
51-
5255
When you expand a collection's documents, |vsce| lists the ``_id`` of
5356
each document in the collection. Click an ``_id`` value to open that
54-
document in VS Code and view its contents.
57+
document in |vscode-short| and view its contents.
5558

56-
.. note::
59+
You may edit this single document:
5760

58-
You cannot open a single document within a read-only view.
61+
.. include:: /includes/seq-edit-document.rst
5962

60-
Alternatively, right-click a collection and click
61-
:guilabel:`View Documents` to view all of the collection's documents
62-
in an array.
63+
To view all of the collection's documents in an array, you can:
6364

64-
Opening collection documents provides a **read-only** view of your data.
65-
To modify your data using |vsce|, use a :ref:`JavaScript Playground
66-
<vsce-crud>` or launch a shell by right-clicking your active deployment
67-
in the MongoDB view in the Activity Bar.
65+
1. Right-click a collection.
66+
2. Click :guilabel:`View Documents`.
6867

6968
.. include:: /includes/admonitions/document-search-template.rst
7069

@@ -87,8 +86,8 @@ field name for a text description of the field's data type.
8786
Manage Indexes
8887
~~~~~~~~~~~~~~
8988

90-
Your collections's indexes are listed under the :guilabel:`Indexes`
91-
heading. When you expand an index, each index key appears with an icon
89+
Your collections's indexes are listed under the :guilabel:`Indexes`
90+
heading. When you expand an index, each index key appears with an icon
9291
designating its type. Index key types include:
9392

9493
- Ascending
@@ -99,15 +98,15 @@ designating its type. Index key types include:
9998

10099
.. note::
101100

102-
You can open a :ref:`MongoDB Playground <vsce-crud>`
103-
pre-configured to create an index by hovering over the
104-
:guilabel:`Indexes` label in the navigation panel and clicking the
105-
:icon-fa4:`plus` icon that appears.
101+
You can open a :ref:`MongoDB Playground <vsce-crud>` pre-configured
102+
to create an index by hovering over the :guilabel:`Indexes` label
103+
in the navigation panel and clicking the :icon-fa4:`plus` icon that
104+
appears.
106105

107106
.. seealso::
108107

109-
For more information about MongoDB indexes, see the documentation in
110-
the :manual:`server manual </indexes>`.
108+
To learn more about MongoDB indexes, see the
109+
:manual:`server manual </indexes>`.
111110

112111
Create a New Database
113112
~~~~~~~~~~~~~~~~~~~~~
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.. note::
2+
3+
|vsce| closes all documents when you close |vscode-short|.

source/includes/seq-edit-document.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
1. At the top of this document, click :guilabel:`Edit Document`.
2+
|vsce| opens it as an editable |ejson| document titled ``<database>.<collection>:"<_id>".json``.
3+
#. Make any edits you require.
4+
#. Press :kbd:`Ctrl + S` (Windows/Linux) or :kbd:`Cmd + S` to save the
5+
edited document to the MongoDB database.
6+
7+
- If the update succeeds, |vsce| confirms that the database has
8+
stored the change.
9+
- If the update results in an error, |vsce| displays it.

source/read-document-playground.txt

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Read Documents
1212
:depth: 1
1313
:class: singlecol
1414

15-
You can read documents in a collection using the
15+
.. |findOne| replace:: :manual:`findOne() </reference/method/db.collection.findOne>`
16+
.. |findAny| replace:: :manual:`find() </reference/method/db.collection.find>`
17+
18+
19+
You can read documents in a collection using the
1620
:manual:`MongoDB CRUD Operators </crud>` in a MongoDB Playground:
1721

18-
- Use the :manual:`findOne()
19-
</reference/method/db.collection.findOne>` method to read one
20-
document.
21-
- Use the :manual:`find()
22-
</reference/method/db.collection.find>` method to read more
23-
than one document.
22+
- Use the |findOne| method to read one document.
23+
- Use the |findAny| method to read more than one document.
2424

2525
.. include:: /includes/admonitions/document-search-template.rst
2626

@@ -30,10 +30,8 @@ Prerequisites
3030
If you have not done so already, you must complete the following
3131
prerequisites before you can read documents with a MongoDB Playground:
3232

33-
- :ref:`Create a connection to a MongoDB deployment
34-
<vsce-connect-task>`.
35-
- :ref:`Activate the connection to the MongoDB deployment
36-
<vsce-activate-connection>`.
33+
- :ref:`Create a connection to a MongoDB deployment <vsce-connect-task>`.
34+
- :ref:`Activate the connection to the MongoDB deployment <vsce-activate-connection>`.
3735
- :ref:`Open a MongoDB Playground <open-playground-for-crud-vsce>`.
3836
- :ref:`vsce-create-doc-playground` or create documents in a collection
3937
using a different method.
@@ -55,12 +53,16 @@ document according to the
5553
:manual:`natural order </reference/glossary/#term-natural-order>` which
5654
reflects the order of documents on the disk.
5755

58-
For a detailed description of this method's parameters,
59-
see :manual:`findOne() </reference/method/db.collection.findOne>`
60-
in the MongoDB Manual.
56+
To learn more about this method's parameters, see |findOne| in the
57+
MongoDB Manual.
6158

6259
.. include:: /includes/run-playground.rst
6360

61+
You may edit any |json| document returned from a |findOne| or |findAny|
62+
operation.
63+
64+
.. include:: /includes/seq-edit-document.rst
65+
6466
Example
6567
~~~~~~~
6668

0 commit comments

Comments
 (0)