@@ -18,24 +18,66 @@ Insert Documents
18
18
:backlinks: none
19
19
:depth: 1
20
20
21
- ----------
21
+ .. include:: /includes/language-selector-instructions.rst
22
22
23
- .. |arrow| unicode :: U+27A4
23
+ .. tabs-selector :: drivers
24
24
25
- |arrow| Use the **Select your language** drop-down menu in the
26
- upper-right to set the language of the examples on this page.
25
+ This page provides examples of insert operations in MongoDB.
27
26
28
- ----------
27
+ You can insert documents in MongoDB by using the following
28
+ methods:
29
29
30
- .. tabs-selector :: drivers
30
+ .. |atlas-ref| replace :: :ref:`insert-documents-atlas`
31
31
32
- This page provides examples of insert operations in MongoDB.
32
+ .. include:: /includes/fact-methods.rst
33
33
34
34
.. note:: Creating a Collection
35
35
36
36
If the collection does not currently exist, insert operations will
37
37
create the collection.
38
38
39
+ .. _insert-documents-atlas:
40
+
41
+ Insert Documents in the {+atlas+} UI
42
+ -------------------------------------------
43
+
44
+ To insert a document in the {+atlas+} UI, complete the following steps.
45
+ To learn more about working with documents in the {+atlas+} UI, see
46
+ :atlas:`Create, View, Update, and Delete Documents
47
+ </atlas-ui/documents>`.
48
+
49
+ .. procedure::
50
+ :style: normal
51
+
52
+ .. step:: Navigate to the collection
53
+
54
+ a. In the {+atlas+} UI, click :guilabel:`Database` in the sidebar.
55
+ #. For the database deployment to which you want to add documents,
56
+ click :guilabel:`Browse Collections`.
57
+ #. In the left navigation pane, select the database.
58
+ #. In the left navigation pane, select the collection.
59
+
60
+ .. step:: Add the documents
61
+
62
+ a. Click :guilabel:`Insert Document`.
63
+ #. Click the :guilabel:`{}` icon, which opens the JSON view.
64
+ #. Paste the document array into the text entry field. For
65
+ example, the following entry creates four documents, each of
66
+ which contain three fields:
67
+
68
+ .. code-block::
69
+
70
+ [
71
+ { "prodId": 100, "price": 20, "quantity": 125 },
72
+ { "prodId": 101, "price": 10, "quantity": 234 },
73
+ { "prodId": 102, "price": 15, "quantity": 432 },
74
+ { "prodId": 103, "price": 17, "quantity": 320 }
75
+ ]
76
+
77
+ .. step:: Click Insert.
78
+
79
+ {+atlas+} adds the documents to the collection.
80
+
39
81
.. _write-op-insertOne:
40
82
41
83
Insert a Single Document
0 commit comments