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