Skip to content

Commit bfb79cb

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

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
@@ -521,12 +521,12 @@ Create a collection ``foodColl`` with the following documents:
521521

522522
.. code-block:: javascript
523523

524-
db.foodColl.insert([
524+
db.foodColl.insertMany( [
525525
{ _id: 1, category: "cake", type: "chocolate", qty: 10 },
526526
{ _id: 2, category: "cake", type: "ice cream", qty: 25 },
527527
{ _id: 3, category: "pie", type: "boston cream", qty: 20 },
528528
{ _id: 4, category: "pie", type: "blueberry", qty: 15 }
529-
])
529+
] )
530530

531531
Create the following indexes:
532532

source/reference/command/collMod.txt

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

427427
.. code-block:: javascript
428428

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

431431
However, since the ``validationAction`` is ``warn`` only, MongoDB only
432432
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
@@ -790,11 +790,11 @@ Create a collection ``students`` with the following documents:
790790

791791
.. code-block:: javascript
792792

793-
db.students.insert([
793+
db.students.insertMany( [
794794
{ "_id" : 1, "grades" : [ 95, 92, 90 ] },
795795
{ "_id" : 2, "grades" : [ 98, 100, 102 ] },
796796
{ "_id" : 3, "grades" : [ 95, 110, 100 ] }
797-
])
797+
] )
798798

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

833833
.. code-block:: javascript
834834

835-
db.students2.insert([
835+
db.students2.insertMany( [
836836
{
837837
"_id" : 1,
838838
"grades" : [
@@ -849,7 +849,7 @@ Create a collection ``students2`` with the following documents:
849849
{ "grade" : 85, "mean" : 85, "std" : 4 }
850850
]
851851
}
852-
])
852+
] )
853853

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

911911
.. code-block:: javascript
912912

913-
db.students2.insert([
913+
db.students2.insertMany( [
914914
{
915915
"_id" : 1,
916916
"grades" : [
@@ -927,7 +927,7 @@ documents:
927927
{ "grade" : 85, "mean" : 85, "std" : 4 }
928928
]
929929
}
930-
])
930+
] )
931931

932932
The following operation finds a document where the ``_id`` field equals
933933
``1`` and uses an aggregation pipeline to calculate a new field
@@ -976,14 +976,14 @@ with the following documents:
976976

977977
.. code-block:: javascript
978978

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

988988
Create the following indexes on the collection:
989989

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)