@@ -195,7 +195,7 @@ The ``updateOne`` and ``updateMany`` methods exist on the ``Collection`` class a
195
195
{{% myproject-connect %}}
196
196
197
197
const col = db.collection('updates');
198
- // Insert a single document
198
+ // Insert multiple documents
199
199
col.insertMany([ {a:1}, {a:2}, {a:2}] , function(err, r) {
200
200
assert.equal(null, err);
201
201
assert.equal(3, r.insertedCount);
@@ -231,7 +231,7 @@ The ``updateOne`` and ``updateMany`` methods exist on the ``Collection`` class a
231
231
232
232
// Get the updates collection
233
233
const col = db.collection('updates');
234
- // Insert a single document
234
+ // Insert multiple documents
235
235
let r = await col.insertMany([{a:1}, {a:2}, {a:2}]);
236
236
assert.equal(3, r.insertedCount);
237
237
@@ -280,7 +280,7 @@ The ``deleteOne`` and ``deleteMany`` methods exist on the ``Collection`` class a
280
280
{{% myproject-connect %}}
281
281
282
282
const col = db.collection('removes');
283
- // Insert a single document
283
+ // Insert multiple documents
284
284
col.insertMany([ {a:1}, {a:2}, {a:2}] , function(err, r) {
285
285
assert.equal(null, err);
286
286
assert.equal(3, r.insertedCount);
@@ -305,7 +305,7 @@ The ``deleteOne`` and ``deleteMany`` methods exist on the ``Collection`` class a
305
305
306
306
// Get the removes collection
307
307
const col = db.collection('removes');
308
- // Insert a single document
308
+ // Insert multiple documents
309
309
let r = await col.insertMany([{a:1}, {a:2}, {a:2}]);
310
310
assert.equal(3, r.insertedCount);
311
311
@@ -347,7 +347,7 @@ methods, the operation takes a write lock for the duration of the operation in o
347
347
{{% myproject-connect %}}
348
348
349
349
const col = db.collection('findAndModify');
350
- // Insert a single document
350
+ // Insert multiple documents
351
351
col.insert([ {a:1}, {a:2}, {a:2}] , function(err, r) {
352
352
assert.equal(null, err);
353
353
assert.equal(3, r.result.n);
@@ -376,7 +376,7 @@ methods, the operation takes a write lock for the duration of the operation in o
376
376
377
377
// Get the findAndModify collection
378
378
const col = db.collection('findAndModify');
379
- // Insert a single document
379
+ // Insert multiple documents
380
380
let r = await col.insert([{a:1}, {a:2}, {a:2}]);
381
381
assert.equal(3, r.result.n);
382
382
@@ -418,7 +418,7 @@ The ``findOneAndDelete`` function is designed to help remove a document.
418
418
{{% myproject-connect %}}
419
419
420
420
const col = db.collection('findAndModify');
421
- // Insert a single document
421
+ // Insert multiple documents
422
422
col.insert([ {a:1}, {a:2}, {a:2}] , function(err, r) {
423
423
assert.equal(null, err);
424
424
assert.equal(3, r.result.n);
@@ -440,7 +440,7 @@ The ``findOneAndDelete`` function is designed to help remove a document.
440
440
441
441
// Get the findAndModify collection
442
442
const col = db.collection('findAndModify');
443
- // Insert a single document
443
+ // Insert multiple documents
444
444
let r = await col.insert([{a:1}, {a:2}, {a:2}]);
445
445
assert.equal(3, r.result.n);
446
446
@@ -645,7 +645,7 @@ The following example materializes all the documents from a query using the ``to
645
645
{{% myproject-connect %}}
646
646
647
647
const col = db.collection('find');
648
- // Insert a single document
648
+ // Insert multiple documents
649
649
col.insertMany([ {a:1}, {a:1}, {a:1}] , function(err, r) {
650
650
assert.equal(null, err);
651
651
assert.equal(3, r.insertedCount);
@@ -664,7 +664,7 @@ The following example materializes all the documents from a query using the ``to
664
664
665
665
// Get the collection
666
666
const col = db.collection('find');
667
- // Insert a single document
667
+ // Insert multiple documents
668
668
const r = await col.insertMany([{a:1}, {a:1}, {a:1}]);
669
669
assert.equal(3, r.insertedCount);
670
670
@@ -719,7 +719,7 @@ The following example uses the ``next`` method.
719
719
{{% myproject-connect %}}
720
720
721
721
const col = db.collection('find');
722
- // Insert a single document
722
+ // Insert multiple documents
723
723
col.insertMany([ {a:1}, {a:1}, {a:1}] , function(err, r) {
724
724
assert.equal(null, err);
725
725
assert.equal(3, r.insertedCount);
@@ -742,7 +742,7 @@ much cleaner and easier way to read iteration code.
742
742
743
743
// Get the collection
744
744
const col = db.collection('find');
745
- // Insert a single document
745
+ // Insert multiple documents
746
746
const r = await col.insertMany([{a:1}, {a:1}, {a:1}]);
747
747
assert.equal(3, r.insertedCount);
748
748
@@ -771,7 +771,7 @@ The following example uses the ``each`` method.
771
771
{{% myproject- connect % }}
772
772
773
773
const col = db .collection (' find' );
774
- // Insert a single document
774
+ // Insert multiple documents
775
775
col .insertMany ([{a: 1 }, {a: 1 }, {a: 1 }], function (err , r ) {
776
776
assert .equal (null , err);
777
777
assert .equal (3 , r .insertedCount );
0 commit comments