Skip to content

Commit 432c938

Browse files
DOCSP-28059 Add insert document context menu action to collections
1 parent 6aeb28e commit 432c938

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

source/databases-collections.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,40 @@ document in |vscode-short| and view its contents.
103103
2. Click :guilabel:`Delete Document`.
104104
3. Click :guilabel:`Yes` to confirm.
105105

106+
*To insert a document*, you can:
107+
108+
1. Right-click the collection where you want to insert a document.
109+
#. Click :guilabel:`Insert Document`.
110+
111+
|vsce| opens the Playground with a template for adding a document to
112+
the collection.
113+
114+
.. code-block:: json
115+
:copyable: false
116+
:caption: Example Playground Template
117+
:linenos:
118+
:emphasize-lines: 8-10
119+
120+
// MongoDB Playground
121+
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
122+
123+
// The current database to use.
124+
use('<database-name>');
125+
126+
// Create a new document in the collection.
127+
db.getCollection('<collection-name>').insertOne({
128+
129+
});
130+
131+
#. Paste the document to add inside the
132+
:method:`db.collection.insertOne()` method and click the
133+
:guilabel:`Play Button`.
134+
135+
#. Click :guilabel:`Yes` to confirm.
136+
137+
The |vsce| :guilabel:`Playground Result` panel displays the ID of the
138+
inserted document.
139+
106140
.. include:: /includes/admonitions/document-search-template.rst
107141

108142
Schema

0 commit comments

Comments
 (0)