Skip to content

Commit ca0d7fa

Browse files
author
Dave
authored
DOCSP-19981 insert updates pt7 v5.1 (#106)
* DOCSP-19981 insert updates pt7 * DOCSP-19981 insert updates pt7 * Fix upstream merge conflict * Method swaps * Old include * Staging updates * Review comments
1 parent a5b7061 commit ca0d7fa

10 files changed

+75
-66
lines changed

source/reference/method/db.collection.insertMany.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ Definition
1818

1919
.. include:: /includes/fact-mongosh-shell-method.rst
2020

21-
22-
.. versionadded:: 3.2
23-
2421
Inserts multiple documents into a collection.
2522

2623
The :method:`~db.collection.insertMany()` method has the following
@@ -131,7 +128,7 @@ unique within the collection to avoid duplicate key error.
131128
Explainability
132129
~~~~~~~~~~~~~~
133130

134-
:method:`~db.collection.insertMany()` is not compatible with
131+
:method:`~db.collection.insertMany()` is not compatible with
135132
:method:`db.collection.explain()`.
136133

137134
Error Handling

source/reference/method/db.collection.insertOne.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ Definition
1818

1919
.. include:: /includes/fact-mongosh-shell-method.rst
2020

21-
22-
.. versionadded:: 3.2
23-
2421
Inserts a document into a collection.
2522

2623
The :method:`~db.collection.insertOne()` method has the following
@@ -102,7 +99,7 @@ unique within the collection to avoid duplicate key error.
10299
Explainability
103100
~~~~~~~~~~~~~~
104101

105-
:method:`~db.collection.insertOne()` is not compatible with
102+
:method:`~db.collection.insertOne()` is not compatible with
106103
:method:`db.collection.explain()`.
107104

108105
Error Handling

source/reference/method/db.collection.updateMany.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ Definition
1515

1616
.. method:: db.collection.updateMany(filter, update, options)
1717

18-
1918
.. include:: /includes/fact-mongosh-shell-method.rst
20-
21-
22-
.. versionadded:: 3.2
2319

2420
Updates all documents that match the specified filter for a
2521
collection.
@@ -307,7 +303,7 @@ full shard key in the ``filter``.
307303
Explainability
308304
~~~~~~~~~~~~~~
309305

310-
:method:`~db.collection.updateMany()` is not compatible with
306+
:method:`~db.collection.updateMany()` is not compatible with
311307
:method:`db.collection.explain()`.
312308

313309
Transactions

source/reference/method/db.collection.updateOne.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ See also:
380380
Explainability
381381
~~~~~~~~~~~~~~
382382

383-
:method:`~db.collection.updateOne()` is not compatible with
383+
:method:`~db.collection.updateOne()` is not compatible with
384384
:method:`db.collection.explain()`.
385385

386386
Transactions

source/reference/program/mongo.txt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,6 @@ Core Options
381381

382382
.. option:: --disableJavaScriptProtection
383383

384-
.. versionadded:: 3.4
385-
386384
Allows fields of type :ref:`javascript<bson-types>` and
387385
:ref:`javascriptWithScope (*Deprecated*) <bson-types>` to be automatically
388386
marshalled to JavaScript functions in the :binary:`~bin.mongo`
@@ -393,12 +391,13 @@ Core Options
393391
The following example demonstrates this behavior within the shell:
394392

395393
.. code-block:: javascript
396-
397-
> db.test.insert({ _id: 1, jsFunc: function(){ print("hello") } } )
394+
:copyable: false
395+
396+
> db.test.insertOne( { _id: 1, jsFunc: function(){ print( "hello" ) } } )
398397
WriteResult({ "nInserted" : 1 })
399-
> var doc = db.test.findOne({ _id: 1 })
398+
> var doc = db.test.findOne( { _id: 1 } )
400399
> doc
401-
{ "_id" : 1, "jsFunc" : function (){ print ("hello") } }
400+
{ "_id" : 1, "jsFunc" : function (){ print ( "hello" ) } }
402401
> typeof doc.jsFunc
403402
function
404403
> doc.jsFunc()
@@ -411,22 +410,20 @@ Core Options
411410
within the shell:
412411

413412
.. code-block:: javascript
414-
415-
> db.test.insert({ _id: 1, jsFunc: function(){ print("hello") } } )
413+
:copyable: false
414+
415+
> db.test.insertOne( { _id: 1, jsFunc: function(){ print("hello") } } )
416416
WriteResult({ "nInserted" : 1 })
417-
> var doc = db.test.findOne({ _id: 1 })
417+
> var doc = db.test.findOne( { _id: 1 } )
418418
> doc
419419
{ "_id" : 1, "jsFunc" : { "code" : "function (){print(\"hello\")}" } }
420-
> typeof doc.func
420+
> typeof doc.jsFunc
421421
object
422-
> doc.func instanceof Code
422+
> doc.jsFunc instanceof Code
423423
true
424424
> doc.jsFunc()
425-
2016-11-09T12:30:36.808-08:00 E QUERY [thread1] TypeError: doc.jsFunc is
426-
not a function :
425+
uncaught exception: TypeError: doc.jsFunc is not a function :
427426
@(shell):1:1
428-
429-
430427

431428
.. _mongo-shell-file:
432429

source/reference/read-concern.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Read Concern
1212
:depth: 1
1313
:class: singlecol
1414

15-
16-
1715
The ``readConcern`` option allows you to control the consistency and
1816
isolation properties of the data read from replica sets and replica set
1917
shards.
@@ -397,8 +395,8 @@ of a multi-document transaction:
397395
- :readconcern:`"linearizable"`
398396

399397
* - | :dbcommand:`delete`
400-
| :method:`db.collection.deleteMany()`
401398
| :method:`db.collection.deleteOne()`
399+
| :method:`db.collection.deleteMany()`
402400
| :method:`db.collection.remove()`
403401
- |checkmark|
404402
-
@@ -419,7 +417,6 @@ of a multi-document transaction:
419417
-
420418

421419
* - | :dbcommand:`insert`
422-
| :method:`db.collection.insert()`
423420
| :method:`db.collection.insertOne()`
424421
| :method:`db.collection.insertMany()`
425422

@@ -430,8 +427,8 @@ of a multi-document transaction:
430427
-
431428

432429
* - | :dbcommand:`update`
433-
| :method:`db.collection.updateMany()`
434430
| :method:`db.collection.updateOne()`
431+
| :method:`db.collection.updateMany()`
435432
| :method:`db.collection.replaceOne()`
436433

437434
- |checkmark|

source/tutorial/configure-audit-filters.txt

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,24 @@ enable the audit system to log authorization successes using the
224224

225225
.. include:: /includes/fact-auditAuthorizationSuccess-performance-impact.rst
226226

227-
The following example audits the :method:`~db.collection.find()`,
228-
:method:`~db.collection.insert()`, :method:`~db.collection.remove()`,
229-
:method:`~db.collection.update()`, and
230-
:method:`~db.collection.findAndModify()` operations by using the filter:
227+
This filter audits multiple read and write operations:
231228

232229
.. code-block:: bash
233230

234-
{ atype: "authCheck", "param.command": { $in: [ "find", "insert", "delete", "update", "findandmodify" ] } }
231+
{
232+
atype: "authCheck",
233+
"param.command": { $in: [ "find", "insert", "delete", "update", "findandmodify" ] }
234+
}
235+
236+
The audited operations include:
237+
238+
- :method:`~db.collection.find()`
239+
- :method:`~db.collection.insertOne()`
240+
- :method:`~db.collection.insertMany()`
241+
- :method:`~db.collection.remove()`
242+
- :method:`~db.collection.updateOne()`
243+
- :method:`~db.collection.updateMany()`
244+
- :method:`~db.collection.findAndModify()`
235245

236246
.. include:: /includes/fact-audit-filter-single-quotes.rst
237247

@@ -269,15 +279,27 @@ enable the audit system to log authorization successes using the
269279

270280
.. include:: /includes/fact-auditAuthorizationSuccess-performance-impact.rst
271281

272-
The following example audits the :method:`~db.collection.find()`,
273-
:method:`~db.collection.insert()`, :method:`~db.collection.remove()`,
274-
:method:`~db.collection.update()`, and
275-
:method:`~db.collection.findAndModify()` operations for the collection
276-
``orders`` in the database ``test`` by using the filter:
282+
This filter audits multiple read and write operations on the ``orders``
283+
collection in the ``test`` database:
277284

278285
.. code-block:: bash
279286

280-
{ atype: "authCheck", "param.ns": "test.orders", "param.command": { $in: [ "find", "insert", "delete", "update", "findandmodify" ] } }
287+
{
288+
atype: "authCheck",
289+
"param.ns": "test.orders",
290+
"param.command": { $in: [ "find", "insert", "delete", "update", "findandmodify" ] }
291+
}
292+
293+
The audited operations include:
294+
295+
- :method:`~db.collection.find()`
296+
- :method:`~db.collection.insertOne()`
297+
- :method:`~db.collection.insertMany()`
298+
- :method:`~db.collection.remove()`
299+
- :method:`~db.collection.updateOne()`
300+
- :method:`~db.collection.updateMany()`
301+
- :method:`~db.collection.findAndModify()`
302+
281303

282304
.. include:: /includes/fact-audit-filter-single-quotes.rst
283305

source/tutorial/configure-replica-set-tag-sets.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,8 @@ Given a five member replica set with members in two data centers:
241241

242242
.. code-block:: javascript
243243

244-
db.collection.insert( { id: "xyz", status: "A" }, { writeConcern: { w: "MultipleDC" } } )
244+
db.collection.insertOne(
245+
{ id: "xyz", status: "A" },
246+
{ writeConcern: { w: "MultipleDC" } }
247+
)
248+

source/tutorial/expire-data.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ field has passed since the time specified in its indexed field.
5959

6060
For example, the following operation creates an index on the
6161
``log_events`` collection's ``createdAt`` field and specifies the
62-
``expireAfterSeconds`` value of ``3600`` to set the expiration time to
63-
be one hour after the time specified by ``createdAt``.
62+
``expireAfterSeconds`` value of ``10`` to set the expiration time to
63+
be ten seconds after the time specified by ``createdAt``.
6464

6565
.. code-block:: javascript
6666

67-
db.log_events.createIndex( { "createdAt": 1 }, { expireAfterSeconds: 3600 } )
67+
db.log_events.createIndex( { "createdAt": 1 }, { expireAfterSeconds: 10 } )
6868

6969
When adding documents to the ``log_events`` collection, set the
7070
``createdAt`` field to the current time:
7171

7272
.. code-block:: javascript
7373

74-
db.log_events.insert( {
74+
db.log_events.insertOne( {
7575
"createdAt": new Date(),
7676
"logEvent": 2,
7777
"logMessage": "Success!"
@@ -107,13 +107,13 @@ For example, the following operation creates an index on the
107107
db.log_events.createIndex( { "expireAt": 1 }, { expireAfterSeconds: 0 } )
108108

109109
For each document, set the value of ``expireAt`` to correspond to the
110-
time the document should expire. For instance, the following
111-
:method:`~db.collection.insert()` operation adds a document that should
112-
expire at ``July 22, 2013 14:00:00``.
110+
time the document should expire. For example, the following
111+
:method:`~db.collection.insertOne()` operation adds a document that
112+
expires at ``July 22, 2013 14:00:00``.
113113

114114
.. code-block:: javascript
115115

116-
db.log_events.insert( {
116+
db.log_events.insertOne( {
117117
"expireAt": new Date('July 22, 2013 14:00:00'),
118118
"logEvent": 2,
119119
"logMessage": "Success!"
@@ -124,3 +124,4 @@ collection when the documents' ``expireAt`` value is older than the
124124
number of seconds specified in ``expireAfterSeconds``, i.e. ``0``
125125
seconds older in this case. As such, the data expires at the specified
126126
``expireAt`` value.
127+

source/tutorial/update-documents-with-aggregation-pipeline.txt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ not currently exist, insert operations will create the collection):
3838

3939
.. code-block:: javascript
4040

41-
db.students.insertMany([
41+
db.students.insertMany( [
4242
{ _id: 1, test1: 95, test2: 92, test3: 90, modified: new Date("01/05/2020") },
4343
{ _id: 2, test1: 98, test2: 100, test3: 102, modified: new Date("01/05/2020") },
4444
{ _id: 3, test1: 95, test2: 110, modified: new Date("01/04/2020") }
45-
])
45+
] )
4646

4747
To verify, query the collection:
4848

@@ -86,10 +86,10 @@ currently exist, insert operations will create the collection):
8686

8787
.. code-block:: javascript
8888

89-
db.students2.insertMany([
89+
db.students2.insertMany( [
9090
{ "_id" : 1, quiz1: 8, test2: 100, quiz2: 9, modified: new Date("01/05/2020") },
9191
{ "_id" : 2, quiz2: 5, test1: 80, test2: 89, modified: new Date("01/05/2020") },
92-
])
92+
] )
9393

9494
To verify, query the collection:
9595

@@ -152,11 +152,11 @@ currently exist, insert operations will create the collection):
152152

153153
.. code-block:: javascript
154154

155-
db.students3.insert([
155+
db.students3.insertMany( [
156156
{ "_id" : 1, "tests" : [ 95, 92, 90 ], "modified" : ISODate("2019-01-01T00:00:00Z") },
157157
{ "_id" : 2, "tests" : [ 94, 88, 90 ], "modified" : ISODate("2019-01-01T00:00:00Z") },
158158
{ "_id" : 3, "tests" : [ 70, 75, 82 ], "modified" : ISODate("2019-01-01T00:00:00Z") }
159-
]);
159+
] );
160160

161161
To verify, query the collection:
162162

@@ -221,11 +221,11 @@ not currently exist, insert operations will create the collection):
221221

222222
.. code-block:: javascript
223223

224-
db.students4.insertMany([
224+
db.students4.insertMany( [
225225
{ "_id" : 1, "quizzes" : [ 4, 6, 7 ] },
226226
{ "_id" : 2, "quizzes" : [ 5 ] },
227227
{ "_id" : 3, "quizzes" : [ 10, 10, 10 ] }
228-
])
228+
] )
229229

230230
To verify, query the collection:
231231

@@ -267,11 +267,11 @@ insert operations will create the collection):
267267

268268
.. code-block:: javascript
269269

270-
db.temperatures.insertMany([
270+
db.temperatures.insertMany( [
271271
{ "_id" : 1, "date" : ISODate("2019-06-23"), "tempsC" : [ 4, 12, 17 ] },
272272
{ "_id" : 2, "date" : ISODate("2019-07-07"), "tempsC" : [ 14, 24, 11 ] },
273273
{ "_id" : 3, "date" : ISODate("2019-10-30"), "tempsC" : [ 18, 6, 8 ] }
274-
])
274+
] )
275275

276276
To verify, query the collection:
277277

@@ -319,8 +319,6 @@ See also the various update method pages for additional examples:
319319

320320
- :ref:`db.collection.updateMany <updateMany-example-agg>`
321321

322-
- :ref:`db.collection.update() <update-example-agg>`
323-
324322
- :ref:`db.collection.findOneAndUpdate() <findOneAndUpdate-agg-pipeline>`
325323

326324
- :ref:`db.collection.findAndModify() <findAndModify-agg-pipeline>`

0 commit comments

Comments
 (0)