@@ -121,10 +121,11 @@ The following example inserts a list of documents into the
121
121
Modify Insert Behavior
122
122
----------------------
123
123
124
- The ``insertOne()`` method optionally accepts a parameter
125
- that sets options to configure the insert operation.
124
+ The ``insertOne()`` method optionally accepts an ``InsertOneOptions``
125
+ parameter that sets options to configure the insert operation.
126
126
If you don't specify any options, the driver performs the insert
127
- operation with default settings.
127
+ operation with default settings. Pass options as the last parameter to
128
+ the ``insertOne()`` method.
128
129
129
130
The following table describes the setter methods that you can use to
130
131
configure an ``InsertOneOptions`` instance:
@@ -133,7 +134,7 @@ configure an ``InsertOneOptions`` instance:
133
134
:widths: 30 70
134
135
:header-rows: 1
135
136
136
- * - Property
137
+ * - Method
137
138
- Description
138
139
139
140
* - ``bypassDocumentValidation()``
@@ -149,16 +150,28 @@ configure an ``InsertOneOptions`` instance:
149
150
You can set the preceding settings on the ``insertMany()`` method
150
151
by configuring an ``InsertManyOptions`` instance. You can also use the
151
152
``ordered()`` method setter method to specify the order in which the driver
152
- inserts documents into MongoDB. If set to ``true``, the driver sends documents to the
153
- server in the order provided. If an error occurs, the driver and server
154
- cancel all remaining insert operations. The driver performs ordered
155
- inserts by default.
153
+ inserts documents into MongoDB:
154
+
155
+ .. list-table::
156
+ :widths: 30 70
157
+ :header-rows: 1
158
+
159
+ * - Method
160
+ - Description
161
+
162
+ * - ``ordered()``
163
+ - | If set to ``true``, the driver sends documents to the
164
+ server in the order provided. If an error occurs, the driver
165
+ cancels all remaining insert operations.
166
+ | Defaults to ``true``.
167
+
168
+ Pass options as the last parameter to the ``insertMany()`` method.
156
169
157
170
Modify Insert Example
158
171
~~~~~~~~~~~~~~~~~~~~~
159
172
160
- The following code creates options and uses the ``bypassDocumentValidation()`` method to
161
- ignore document validation rules. Then, the example uses the
173
+ The following code uses the ``bypassDocumentValidation()`` method to
174
+ set the option to ignore document validation rules. Then, the example uses the
162
175
``insertMany()`` method to add new documents to the ``restaurants``
163
176
collection.
164
177
@@ -178,16 +191,34 @@ the ``insertMany()`` method returns an ``InsertManyResult`` instance.
178
191
You can use the following methods to retrieve information from
179
192
an ``InsertOneResult`` instance:
180
193
181
- - ``getInsertedId()``, which indicates the ``_id`` value of the inserted document
182
- - ``wasAcknowledged()``, which returns ``true`` if the server
183
- acknowledges the result
194
+ .. list-table::
195
+ :widths: 30 70
196
+ :header-rows: 1
197
+
198
+ * - Method
199
+ - Description
200
+
201
+ * - ``getInsertedId()``
202
+ - Indicates the ``_id`` value of the inserted document.
203
+
204
+ * - ``wasAcknowledged()``
205
+ - Returns ``true`` if the server acknowledges the result.
184
206
185
207
You can use the following methods to retrieve information from
186
208
an ``InsertOneResult`` instance:
187
209
188
- - ``getInsertedIds()``, which indicates the ``_id`` values of the inserted documents
189
- - ``wasAcknowledged()``, which returns ``true`` if the server
190
- acknowledges the result
210
+ .. list-table::
211
+ :widths: 30 70
212
+ :header-rows: 1
213
+
214
+ * - Method
215
+ - Description
216
+
217
+ * - ``getInsertedIds()``
218
+ - Indicates the ``_id`` values of the inserted documents.
219
+
220
+ * - ``wasAcknowledged()``
221
+ - Returns ``true`` if the server acknowledges the result.
191
222
192
223
.. note::
193
224
0 commit comments