Skip to content

Commit

Permalink
DOCSP-28059 Add insert document context menu action to collections
Browse files Browse the repository at this point in the history
  • Loading branch information
kanchana-mongodb committed Feb 26, 2024
1 parent 6aeb28e commit 432c938
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions source/databases-collections.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,40 @@ document in |vscode-short| and view its contents.
2. Click :guilabel:`Delete Document`.
3. Click :guilabel:`Yes` to confirm.

*To insert a document*, you can:

1. Right-click the collection where you want to insert a document.
#. Click :guilabel:`Insert Document`.

|vsce| opens the Playground with a template for adding a document to
the collection.

.. code-block:: json
:copyable: false
:caption: Example Playground Template
:linenos:
:emphasize-lines: 8-10

// MongoDB Playground
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.

// The current database to use.
use('<database-name>');

// Create a new document in the collection.
db.getCollection('<collection-name>').insertOne({

});

#. Paste the document to add inside the
:method:`db.collection.insertOne()` method and click the
:guilabel:`Play Button`.

#. Click :guilabel:`Yes` to confirm.

The |vsce| :guilabel:`Playground Result` panel displays the ID of the
inserted document.

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

Schema
Expand Down

0 comments on commit 432c938

Please sign in to comment.