Skip to content

Commit ffab4c2

Browse files
committed
Sync bulkwrite/insert with EN
1 parent 7a3a56f commit ffab4c2

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

  • reference/mongodb/mongodb/driver/bulkwrite

reference/mongodb/mongodb/driver/bulkwrite/insert.xml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 53242ee6628dc1ae6989fe002231fddfd8f005c6 Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 2a9a8244a05d5d870de10b7000394f4e6bd4ebbb Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="mongodb-driver-bulkwrite.insert" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -87,15 +87,15 @@
8787
8888
$bulk = new MongoDB\Driver\BulkWrite;
8989
90-
$document1 = ['title' => 'one'];
91-
$document2 = ['_id' => 'custom ID', 'title' => 'two'];
92-
$document3 = ['_id' => new MongoDB\BSON\ObjectId, 'title' => 'three'];
90+
$doc1 = ['x' => 1];
91+
$doc2 = ['_id' => 'custom-id', 'x' => 2];
92+
$doc3 = ['_id' => new MongoDB\BSON\ObjectId('0123456789abcdef01234567'), 'x' => 3];
9393
94-
$_id1 = $bulk->insert($document1);
95-
$_id2 = $bulk->insert($document2);
96-
$_id3 = $bulk->insert($document3);
94+
$id1 = $bulk->insert($doc1);
95+
$id2 = $bulk->insert($doc2);
96+
$id3 = $bulk->insert($doc3);
9797
98-
var_dump($_id1, $_id2, $_id3);
98+
var_dump($id1, $id2, $id3);
9999
100100
$manager = new MongoDB\Driver\Manager('mongodb://localhost:27017');
101101
$result = $manager->executeBulkWrite('db.collection', $bulk);
@@ -108,10 +108,13 @@ $result = $manager->executeBulkWrite('db.collection', $bulk);
108108
<![CDATA[
109109
object(MongoDB\BSON\ObjectId)#3 (1) {
110110
["oid"]=>
111-
string(24) "54d51146bd21b91405401d92"
111+
string(24) "67f58058d1a0aa2fd80d55d0"
112+
}
113+
string(9) "custom-id"
114+
object(MongoDB\BSON\ObjectId)#4 (1) {
115+
["oid"]=>
116+
string(24) "0123456789abcdef01234567"
112117
}
113-
NULL
114-
NULL
115118
]]>
116119
</screen>
117120
</example>

0 commit comments

Comments
 (0)