Skip to content

Commit d8b4ed3

Browse files
author
Dave
authored
Docsp 19904 update db collection.insert pt2 v5.1 (#76) (#80)
* DOCSP-19904 update db.collection.insert pt2 * Two more pages via includes * Remove unused includes * Update spacing * Spacing
1 parent 32b7915 commit d8b4ed3

12 files changed

+22
-137
lines changed

source/includes/extracts-projection.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ content: |
311311
312312
.. code-block:: javascript
313313
314-
db.players.insert( {
314+
db.players.insertOne( {
315315
name: "player1",
316316
games: [ { game: "abc", score: 8 }, { game: "xyz", score: 5 } ],
317317
joined: new Date("2020-01-01"),

source/includes/fact-sparse-index-hint-count.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ index results in an incorrect count.
66

77
.. code-block:: javascript
88
9-
db.collection.insert({ _id: 1, y: 1 } );
9+
db.collection.insertOne( { _id: 1, y: 1 } );
1010
db.collection.createIndex( { x: 1 }, { sparse: true } );
1111
1212
db.collection.find().hint( { x: 1 } ).count();
@@ -19,5 +19,5 @@ documents in a collection.
1919
2020
db.collection.find().count();
2121
22-
db.collection.createIndex({ y: 1 });
23-
db.collection.find().hint({ y: 1 }).count();
22+
db.collection.createIndex( { y: 1 } );
23+
db.collection.find().hint( { y: 1 } ).count();

source/includes/fact-type-fidelity-loss-example.rst

Lines changed: 0 additions & 48 deletions
This file was deleted.

source/includes/let-example-create-flavors.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ Create a collection ``cakeFlavors``:
22

33
.. code-block:: javascript
44
5-
db.cakeFlavors.insert( [
5+
db.cakeFlavors.insertMany( [
66
{ _id: 1, flavor: "chocolate" },
77
{ _id: 2, flavor: "strawberry" },
88
{ _id: 3, flavor: "cherry" }
9-
] )
9+
] )
10+

source/includes/let-variables-example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Create a collection ``cakeSales`` containing sales for cake flavors:
22

33
.. code-block:: javascript
44
5-
db.cakeSales.insert( [
5+
db.cakeSales.insertMany( [
66
{ _id: 1, flavor: "chocolate", salesTotal: 1580 },
77
{ _id: 2, flavor: "strawberry", salesTotal: 4350 },
88
{ _id: 3, flavor: "cherry", salesTotal: 2150 }

source/includes/steps-authorization-create-users.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,5 @@ content: |
180180
181181
.. code-block:: javascript
182182
183-
db.foo.insert( { x: 1, y: 1 } )
183+
db.foo.insertOne( { x: 1, y: 1 } )
184184
...

source/includes/steps-test-generate-multiple-documents.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

source/includes/table-transactions-operations.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070

7171
* - | :method:`db.collection.insertMany()`
7272
| :method:`db.collection.insertOne()`
73-
| :method:`db.collection.insert()`
7473
7574
- :dbcommand:`insert`
7675

source/reference/command/aggregate.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,12 @@ Create a collection ``foodColl`` with the following documents:
506506

507507
.. code-block:: javascript
508508

509-
db.foodColl.insert([
509+
db.foodColl.insertMany( [
510510
{ _id: 1, category: "cake", type: "chocolate", qty: 10 },
511511
{ _id: 2, category: "cake", type: "ice cream", qty: 25 },
512512
{ _id: 3, category: "pie", type: "boston cream", qty: 20 },
513513
{ _id: 4, category: "pie", type: "blueberry", qty: 15 }
514-
])
514+
] )
515515

516516
Create the following indexes:
517517

source/reference/command/collMod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ For example, the following insert operation violates the validation rule.
428428

429429
.. code-block:: javascript
430430

431-
db.contacts.insert( { name: "Amanda", status: "Updated" } )
431+
db.contacts.insertOne( { name: "Amanda", status: "Updated" } )
432432

433433
However, since the ``validationAction`` is ``warn`` only, MongoDB only
434434
logs the validation violation message and allows the operation to

source/reference/command/findAndModify.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,11 @@ Create a collection ``students`` with the following documents:
788788

789789
.. code-block:: javascript
790790

791-
db.students.insert([
791+
db.students.insertMany( [
792792
{ "_id" : 1, "grades" : [ 95, 92, 90 ] },
793793
{ "_id" : 2, "grades" : [ 98, 100, 102 ] },
794794
{ "_id" : 3, "grades" : [ 95, 110, 100 ] }
795-
])
795+
] )
796796

797797
To modify all elements that are greater than or equal to ``100`` in the
798798
``grades`` array, use the positional :update:`$[\<identifier\>]`
@@ -830,7 +830,7 @@ Create a collection ``students2`` with the following documents:
830830

831831
.. code-block:: javascript
832832

833-
db.students2.insert([
833+
db.students2.insertMany( [
834834
{
835835
"_id" : 1,
836836
"grades" : [
@@ -847,7 +847,7 @@ Create a collection ``students2`` with the following documents:
847847
{ "grade" : 85, "mean" : 85, "std" : 4 }
848848
]
849849
}
850-
])
850+
] )
851851

852852
The following operation finds a document where the ``_id`` field equals
853853
``1`` and uses the filtered positional operator :update:`$[\<identifier\>]` with
@@ -908,7 +908,7 @@ documents:
908908

909909
.. code-block:: javascript
910910

911-
db.students2.insert([
911+
db.students2.insertMany( [
912912
{
913913
"_id" : 1,
914914
"grades" : [
@@ -925,7 +925,7 @@ documents:
925925
{ "grade" : 85, "mean" : 85, "std" : 4 }
926926
]
927927
}
928-
])
928+
] )
929929

930930
The following operation finds a document where the ``_id`` field equals
931931
``1`` and uses an aggregation pipeline to calculate a new field
@@ -974,14 +974,14 @@ with the following documents:
974974

975975
.. code-block:: javascript
976976

977-
db.members.insertMany([
977+
db.members.insertMany( [
978978
{ "_id" : 1, "member" : "abc123", "status" : "P", "points" : 0, "misc1" : null, "misc2" : null },
979979
{ "_id" : 2, "member" : "xyz123", "status" : "A", "points" : 60, "misc1" : "reminder: ping me at 100pts", "misc2" : "Some random comment" },
980980
{ "_id" : 3, "member" : "lmn123", "status" : "P", "points" : 0, "misc1" : null, "misc2" : null },
981981
{ "_id" : 4, "member" : "pqr123", "status" : "D", "points" : 20, "misc1" : "Deactivated", "misc2" : null },
982982
{ "_id" : 5, "member" : "ijk123", "status" : "P", "points" : 0, "misc1" : null, "misc2" : null },
983983
{ "_id" : 6, "member" : "cde123", "status" : "A", "points" : 86, "misc1" : "reminder: ping me at 100pts", "misc2" : "Some random comment" }
984-
])
984+
] )
985985

986986
Create the following indexes on the collection:
987987

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,12 @@ Create a collection ``foodColl`` with the following documents:
513513

514514
.. code-block:: javascript
515515

516-
db.foodColl.insert([
516+
db.foodColl.insertMany( [
517517
{ _id: 1, category: "cake", type: "chocolate", qty: 10 },
518518
{ _id: 2, category: "cake", type: "ice cream", qty: 25 },
519519
{ _id: 3, category: "pie", type: "boston cream", qty: 20 },
520520
{ _id: 4, category: "pie", type: "blueberry", qty: 15 }
521-
])
521+
] )
522522

523523
Create the following indexes:
524524

0 commit comments

Comments
 (0)