@@ -6,10 +6,12 @@ Modify Documents
6
6
7
7
.. default-domain:: mongodb
8
8
9
- You can edit existing documents in your collection. When you edit
10
- a document, |compass-short| performs a
11
- :manual:`findAndModify </reference/method/db.collection.findAndModify/>`
12
- operation to update the document.
9
+ You can edit existing documents in your collection.
10
+
11
+ .. include:: /includes/fact-modify-findOneAndUpdate.rst
12
+
13
+ .. include:: /includes/fact-modify-findOneAndReplace.rst
14
+
13
15
14
16
Limitations
15
17
-----------
@@ -36,7 +38,6 @@ documents in List, JSON, or Table view:
36
38
:figwidth: 620px
37
39
:alt: Document View Selection
38
40
39
- |
40
41
41
42
.. tabs::
42
43
@@ -47,68 +48,77 @@ documents in List, JSON, or Table view:
47
48
icon:
48
49
49
50
.. figure:: /images/compass/edit-doc.png
50
- :figwidth: 696px
51
+ :figwidth: 696px
52
+ :alt: Document Edit Selection
51
53
52
54
After you click the pencil icon, the document enters edit mode:
53
55
54
56
.. figure:: /images/compass/edit-doc2.png
55
- :figwidth: 696px
57
+ :figwidth: 696px
58
+ :alt: Document Edit Mode
56
59
57
60
You can now make changes to the fields, values, or data types
58
61
of values.
59
62
60
63
Delete Fields
61
- -------------
64
+ ~~~~~~~~~~~~~
62
65
63
66
To delete a field from a document, click the ``x`` icon to the
64
67
left of the field:
65
68
66
69
.. figure:: /images/compass/edit-doc3.png
67
- :figwidth: 740px
70
+ :figwidth: 740px
71
+ :alt: Document Deletion
68
72
69
73
Once selected, the field is marked for removal and appears
70
74
highlighted in red:
71
75
72
76
.. figure:: /images/compass/edit-doc4.png
73
- :figwidth: 740px
77
+ :figwidth: 740px
78
+ :alt: Document Removal View
74
79
75
80
Add New Fields
76
- --------------
81
+ ~~~~~~~~~~~~~~
77
82
78
- To add a new field in the document, hover over the row number in
79
- the dialog (the row number is not part of the document but the
80
- dialog display) and click on the plus sign add a new field after
81
- the field.
83
+ To add a new field in the document after an existing field, hover
84
+ over the row number in the dialog and click on the plus sign. The
85
+ row number is not part of the document but is part of the dialog display.
82
86
83
87
You can also add a new field at the end of the document by
84
88
pressing the tab key when your text cursor is in the value of the
85
89
last document field.
86
90
87
91
Modify an Existing Field
88
- ------------------------
92
+ ~~~~~~~~~~~~~~~~~~~~~~~~
89
93
90
- You can modify documents by clicking on existing field names or
91
- values and making changes. In this example, the flight status was
94
+ To modify documents, click on existing field names or
95
+ values and make changes. In this example, the flight status was
92
96
changed from ``L`` to ``M``. Changed fields appear highlighted in
93
97
yellow:
94
98
95
99
.. figure:: /images/compass/update-field.png
96
- :figwidth: 740px
100
+ :figwidth: 740px
101
+ :alt: Document Update View
102
+
103
+ .. include:: /includes/fact-modify-findOneAndUpdate.rst
104
+
105
+ .. include:: /includes/fact-modify-prevent-overwrites.rst
97
106
98
107
Save Changes
99
- ------------
108
+ ~~~~~~~~~~~~
100
109
101
110
When you are finished editing the document, click the ``Update``
102
111
button to commit your changes.
103
112
104
113
Revert a Change
105
- ---------------
114
+ ~~~~~~~~~~~~~~~
106
115
107
116
To revert changes to a document, hover over the edited field
108
117
and click the :guilabel:`revert icon` which appears to the left
109
118
of the field's line number.
110
119
111
120
.. figure:: /images/compass/revert-doc-list-view.png
121
+ :alt: Revert Document in List View
112
122
113
123
.. tab:: JSON View
114
124
:tabid: json
@@ -121,13 +131,14 @@ documents in List, JSON, or Table view:
121
131
icon:
122
132
123
133
.. figure:: /images/compass/document-edit-json.png
124
- :figwidth: 696px
134
+ :figwidth: 696px
135
+ :alt: Document Edit Selection in JSON View
125
136
126
137
After you click the pencil icon, the document enters edit mode.
127
138
You can now add, remove, and edit field values by modifying
128
139
the JSON document.
129
140
130
- By default, embedded objects and arrays are hidden . To expand
141
+ By default, this view hides embedded objects and arrays. To expand
131
142
embedded objects and array elements, hover over the target
132
143
document and click the top arrow on the left side of the document.
133
144
@@ -136,7 +147,11 @@ documents in List, JSON, or Table view:
136
147
137
148
.. figure:: /images/compass/expand-doc-json-view.png
138
149
:figwidth: 696px
139
- :alt: Expand embedded objects JSON
150
+ :alt: Expand embedded objects in JSON view
151
+
152
+ .. include:: /includes/fact-modify-findOneAndReplace.rst
153
+
154
+ .. include:: /includes/fact-modify-prevent-overwrites.rst
140
155
141
156
.. tab:: Table View
142
157
:tabid: table-view
@@ -146,14 +161,20 @@ documents in List, JSON, or Table view:
146
161
147
162
.. figure:: /images/compass/table-view-modify.png
148
163
:figwidth: 696px
164
+ :alt: Document Edit Selection in Table View
149
165
150
166
After you click the pencil icon, the document enters edit mode:
151
167
152
168
.. figure:: /images/compass/document-edit-table.png
153
- :figwidth: 696px
169
+ :figwidth: 696px
170
+ :alt: Document Edit Mode in Table View
171
+
172
+ .. include:: /includes/fact-modify-findOneAndUpdate.rst
173
+
174
+ .. include:: /includes/fact-modify-prevent-overwrites.rst
154
175
155
176
Delete Fields
156
- -------------
177
+ ~~~~~~~~~~~~~
157
178
158
179
To delete a field from a document:
159
180
@@ -164,7 +185,7 @@ documents in List, JSON, or Table view:
164
185
#. Click :guilabel:`Update` to confirm your changes.
165
186
166
187
Add New Fields
167
- --------------
188
+ ~~~~~~~~~~~~~~
168
189
169
190
To add a new field to the document:
170
191
@@ -179,7 +200,7 @@ documents in List, JSON, or Table view:
179
200
#. Click :guilabel:`Update` to confirm your changes.
180
201
181
202
Revert a Change
182
- ---------------
203
+ ~~~~~~~~~~~~~~~
183
204
184
205
While modifying a document, you have the option to revert changes
185
206
made to a field prior to saving the modified document.
@@ -188,6 +209,7 @@ documents in List, JSON, or Table view:
188
209
right side of the edited table element.
189
210
190
211
.. figure:: /images/compass/revert-doc-table-view.png
212
+ :alt: Document Revert Changes in Table View
191
213
192
214
Cancel Changes
193
215
--------------
0 commit comments