Skip to content

Commit 12b99a7

Browse files
jmikolaalcaeus
authored andcommitted
MongoDB\Driver\BulkWriteCommandResult
1 parent f9a96c9 commit 12b99a7

12 files changed

+1129
-0
lines changed

reference/mongodb/mongodb.xml

+1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@
3030
&reference.mongodb.mongodb.driver.writeconcernerror;
3131
&reference.mongodb.mongodb.driver.writeerror;
3232
&reference.mongodb.mongodb.driver.writeresult;
33+
&reference.mongodb.mongodb.driver.bulkwritecommandresult;
3334
</part>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<reference xml:id="class.mongodb-driver-bulkwritecommandresult" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
5+
6+
<title>The MongoDB\Driver\BulkWriteCommandResult class</title>
7+
<titleabbrev>MongoDB\Driver\BulkWriteCommandResult</titleabbrev>
8+
9+
<partintro>
10+
11+
<!-- {{{ MongoDB\Driver\BulkWriteCommandResult intro -->
12+
<section xml:id="mongodb-driver-bulkwritecommandresult.intro">
13+
&reftitle.intro;
14+
<para>
15+
The <classname>MongoDB\Driver\BulkWriteCommandResult</classname> class
16+
encapsulates information about an executed
17+
<classname>MongoDB\Driver\BulkWriteCommand</classname> and is returned by
18+
<methodname>MongoDB\Driver\Manager::executeBulkWriteCommand</methodname>.
19+
</para>
20+
</section>
21+
<!-- }}} -->
22+
23+
<section xml:id="mongodb-driver-bulkwritecommandresult.synopsis">
24+
&reftitle.classsynopsis;
25+
26+
<!-- {{{ Synopsis -->
27+
<classsynopsis>
28+
<ooclass><classname>MongoDB\Driver\BulkWriteCommandResult</classname></ooclass>
29+
30+
<!-- {{{ Class synopsis -->
31+
<classsynopsisinfo>
32+
<modifier>final</modifier>
33+
<ooclass>
34+
<classname>MongoDB\Driver\BulkWriteCommandResult</classname>
35+
</ooclass>
36+
</classsynopsisinfo>
37+
<!-- }}} -->
38+
39+
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
40+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongodb-driver-bulkwritecommandresult')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
41+
</classsynopsis>
42+
<!-- }}} -->
43+
44+
</section>
45+
46+
</partintro>
47+
48+
&reference.mongodb.mongodb.driver.entities.bulkwritecommandresult;
49+
50+
</reference>
51+
52+
<!-- Keep this comment at the end of the file
53+
Local variables:
54+
mode: sgml
55+
sgml-omittag:t
56+
sgml-shorttag:t
57+
sgml-minimize-attributes:nil
58+
sgml-always-quote-attributes:t
59+
sgml-indent-step:1
60+
sgml-indent-data:t
61+
indent-tabs-mode:nil
62+
sgml-parent-document:nil
63+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
64+
sgml-exposed-tags:nil
65+
sgml-local-catalogs:nil
66+
sgml-local-ecat-files:nil
67+
End:
68+
vim600: syn=xml fen fdm=syntax fdl=2 si
69+
vim: et tw=78 syn=sgml
70+
vi: ts=1 sw=1
71+
-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<refentry xml:id="mongodb-driver-bulkwritecommandresult.getdeletedcount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<refnamediv>
6+
<refname>MongoDB\Driver\BulkWriteCommandResult::getDeletedCount</refname>
7+
<refpurpose>Returns the number of documents deleted</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis>
13+
<modifier>final</modifier> <modifier>public</modifier> <type>int</type><methodname>MongoDB\Driver\BulkWriteCommandResult::getDeletedCount</methodname>
14+
<void />
15+
</methodsynopsis>
16+
<para>
17+
</para>
18+
</refsect1>
19+
20+
<refsect1 role="parameters">
21+
&reftitle.parameters;
22+
&no.function.parameters;
23+
</refsect1>
24+
25+
<refsect1 role="returnvalues">
26+
&reftitle.returnvalues;
27+
<para>
28+
Returns the total number of documents deleted by all operations.
29+
</para>
30+
</refsect1>
31+
32+
<refsect1 role="errors">
33+
&reftitle.errors;
34+
<simplelist>
35+
&mongodb.throws.argumentparsing;
36+
&mongodb.throws.unacknowledged;
37+
</simplelist>
38+
</refsect1>
39+
40+
<refsect1 role="examples">
41+
&reftitle.examples;
42+
<example>
43+
<title><function>MongoDB\Driver\BulkWriteCommandResult::getDeletedCount</function> example</title>
44+
<programlisting role="php">
45+
<![CDATA[
46+
<?php
47+
48+
$manager = new MongoDB\Driver\Manager;
49+
50+
$bulk = new MongoDB\Driver\BulkWriteCommand;
51+
$bulk->insertOne('db.coll', ['x' => 1]);
52+
$bulk->updateOne('db.coll', ['x' => 1], ['$set' => ['y' => 3]]);
53+
$bulk->updateOne('db.coll', ['x' => 2], ['$set' => ['y' => 1]], ['upsert' => true]);
54+
$bulk->updateOne('db.coll', ['x' => 3], ['$set' => ['y' => 2]], ['upsert' => true]);
55+
$bulk->deleteMany('db.coll', []);
56+
57+
$result = $manager->executeBulkWriteCommand($bulk);
58+
59+
var_dump($result->getDeletedCount());
60+
61+
?>
62+
]]>
63+
</programlisting>
64+
&example.outputs;
65+
<screen>
66+
<![CDATA[
67+
int(3)
68+
]]>
69+
</screen>
70+
</example>
71+
</refsect1>
72+
73+
<refsect1 role="seealso">
74+
&reftitle.seealso;
75+
<simplelist>
76+
<member><methodname>MongoDB\Driver\BulkWriteCommandResult::getDeleteResults</methodname></member>
77+
<member><methodname>MongoDB\Driver\BulkWriteCommandResult::isAcknowledged</methodname></member>
78+
</simplelist>
79+
</refsect1>
80+
81+
</refentry>
82+
83+
<!-- Keep this comment at the end of the file
84+
Local variables:
85+
mode: sgml
86+
sgml-omittag:t
87+
sgml-shorttag:t
88+
sgml-minimize-attributes:nil
89+
sgml-always-quote-attributes:t
90+
sgml-indent-step:1
91+
sgml-indent-data:t
92+
indent-tabs-mode:nil
93+
sgml-parent-document:nil
94+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
95+
sgml-exposed-tags:nil
96+
sgml-local-catalogs:nil
97+
sgml-local-ecat-files:nil
98+
End:
99+
vim600: syn=xml fen fdm=syntax fdl=2 si
100+
vim: et tw=78 syn=sgml
101+
vi: ts=1 sw=1
102+
-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<refentry xml:id="mongodb-driver-bulkwritecommandresult.getdeleteresults" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<refnamediv>
6+
<refname>MongoDB\Driver\BulkWriteCommandResult::getDeleteResults</refname>
7+
<refpurpose>Returns verbose results for successful deletes</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis>
13+
<modifier>final</modifier> <modifier>public</modifier> <type class="union"><type>MongoDB\BSON\Document</type><type>null</type></type><methodname>MongoDB\Driver\BulkWriteCommandResult::getDeleteResults</methodname>
14+
<void />
15+
</methodsynopsis>
16+
<para>
17+
</para>
18+
</refsect1>
19+
20+
<refsect1 role="parameters">
21+
&reftitle.parameters;
22+
&no.function.parameters;
23+
</refsect1>
24+
25+
<refsect1 role="returnvalues">
26+
&reftitle.returnvalues;
27+
<para>
28+
Returns a document containing the result of each successful delete
29+
operation, or &null; if verbose results were not requested. The document
30+
keys will correspond to the index of the write operation from
31+
<classname>MongoDB\Driver\BulkWriteCommand</classname>.
32+
</para>
33+
</refsect1>
34+
35+
<refsect1 role="errors">
36+
&reftitle.errors;
37+
<simplelist>
38+
&mongodb.throws.argumentparsing;
39+
&mongodb.throws.unacknowledged;
40+
</simplelist>
41+
</refsect1>
42+
43+
<refsect1 role="examples">
44+
&reftitle.examples;
45+
<example>
46+
<title><function>MongoDB\Driver\BulkWriteCommandResult::getDeleteResults</function> example</title>
47+
<programlisting role="php">
48+
<![CDATA[
49+
<?php
50+
51+
$manager = new MongoDB\Driver\Manager;
52+
53+
$bulk = new MongoDB\Driver\BulkWriteCommand(['verboseResults' => true]);
54+
$bulk->insertOne('db.coll', ['x' => 1]);
55+
$bulk->updateOne('db.coll', ['x' => 1], ['$set' => ['y' => 3]]);
56+
$bulk->updateOne('db.coll', ['x' => 2], ['$set' => ['y' => 1]], ['upsert' => true]);
57+
$bulk->updateOne('db.coll', ['x' => 3], ['$set' => ['y' => 2]], ['upsert' => true]);
58+
$bulk->deleteMany('db.coll', []);
59+
60+
$result = $manager->executeBulkWriteCommand($bulk);
61+
62+
var_dump($result->getDeleteResults()->toPHP());
63+
64+
?>
65+
]]>
66+
</programlisting>
67+
&example.outputs.similar;
68+
<screen>
69+
<![CDATA[
70+
object(stdClass)#7 (1) {
71+
["4"]=>
72+
object(stdClass)#6 (1) {
73+
["deletedCount"]=>
74+
object(MongoDB\BSON\Int64)#5 (1) {
75+
["integer"]=>
76+
string(1) "3"
77+
}
78+
}
79+
}
80+
]]>
81+
</screen>
82+
</example>
83+
</refsect1>
84+
85+
<refsect1 role="seealso">
86+
&reftitle.seealso;
87+
<simplelist>
88+
<member><methodname>MongoDB\Driver\BulkWriteCommandResult::getDeletedCount</methodname></member>
89+
<member><methodname>MongoDB\Driver\BulkWriteCommandResult::isAcknowledged</methodname></member>
90+
</simplelist>
91+
</refsect1>
92+
93+
</refentry>
94+
95+
<!-- Keep this comment at the end of the file
96+
Local variables:
97+
mode: sgml
98+
sgml-omittag:t
99+
sgml-shorttag:t
100+
sgml-minimize-attributes:nil
101+
sgml-always-quote-attributes:t
102+
sgml-indent-step:1
103+
sgml-indent-data:t
104+
indent-tabs-mode:nil
105+
sgml-parent-document:nil
106+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
107+
sgml-exposed-tags:nil
108+
sgml-local-catalogs:nil
109+
sgml-local-ecat-files:nil
110+
End:
111+
vim600: syn=xml fen fdm=syntax fdl=2 si
112+
vim: et tw=78 syn=sgml
113+
vi: ts=1 sw=1
114+
-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<refentry xml:id="mongodb-driver-bulkwritecommandresult.getinsertedcount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<refnamediv>
6+
<refname>MongoDB\Driver\BulkWriteCommandResult::getInsertedCount</refname>
7+
<refpurpose>Returns the number of documents inserted</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<methodsynopsis>
13+
<modifier>final</modifier> <modifier>public</modifier> <type>int</type><methodname>MongoDB\Driver\BulkWriteCommandResult::getInsertedCount</methodname>
14+
<void />
15+
</methodsynopsis>
16+
<para>
17+
</para>
18+
</refsect1>
19+
20+
<refsect1 role="parameters">
21+
&reftitle.parameters;
22+
&no.function.parameters;
23+
</refsect1>
24+
25+
<refsect1 role="returnvalues">
26+
&reftitle.returnvalues;
27+
<para>
28+
Returns the total number of documents inserted (excluding upserts) by all
29+
operations.
30+
</para>
31+
</refsect1>
32+
33+
<refsect1 role="errors">
34+
&reftitle.errors;
35+
<simplelist>
36+
&mongodb.throws.argumentparsing;
37+
&mongodb.throws.unacknowledged;
38+
</simplelist>
39+
</refsect1>
40+
41+
<refsect1 role="examples">
42+
&reftitle.examples;
43+
<example>
44+
<title><function>MongoDB\Driver\BulkWriteCommandResult::getInsertedCount</function> example</title>
45+
<programlisting role="php">
46+
<![CDATA[
47+
<?php
48+
49+
$manager = new MongoDB\Driver\Manager;
50+
51+
$bulk = new MongoDB\Driver\BulkWriteCommand;
52+
$bulk->insertOne('db.coll', ['x' => 1]);
53+
$bulk->updateOne('db.coll', ['x' => 1], ['$set' => ['y' => 3]]);
54+
$bulk->updateOne('db.coll', ['x' => 2], ['$set' => ['y' => 1]], ['upsert' => true]);
55+
$bulk->updateOne('db.coll', ['x' => 3], ['$set' => ['y' => 2]], ['upsert' => true]);
56+
$bulk->deleteMany('db.coll', []);
57+
58+
$result = $manager->executeBulkWriteCommand($bulk);
59+
60+
var_dump($result->getInsertedCount());
61+
62+
?>
63+
]]>
64+
</programlisting>
65+
&example.outputs;
66+
<screen>
67+
<![CDATA[
68+
int(1)
69+
]]>
70+
</screen>
71+
</example>
72+
</refsect1>
73+
74+
<refsect1 role="seealso">
75+
&reftitle.seealso;
76+
<simplelist>
77+
<member><methodname>MongoDB\Driver\BulkWriteCommandResult::getInsertResults</methodname></member>
78+
<member><methodname>MongoDB\Driver\BulkWriteCommandResult::isAcknowledged</methodname></member>
79+
</simplelist>
80+
</refsect1>
81+
82+
</refentry>
83+
84+
<!-- Keep this comment at the end of the file
85+
Local variables:
86+
mode: sgml
87+
sgml-omittag:t
88+
sgml-shorttag:t
89+
sgml-minimize-attributes:nil
90+
sgml-always-quote-attributes:t
91+
sgml-indent-step:1
92+
sgml-indent-data:t
93+
indent-tabs-mode:nil
94+
sgml-parent-document:nil
95+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
96+
sgml-exposed-tags:nil
97+
sgml-local-catalogs:nil
98+
sgml-local-ecat-files:nil
99+
End:
100+
vim600: syn=xml fen fdm=syntax fdl=2 si
101+
vim: et tw=78 syn=sgml
102+
vi: ts=1 sw=1
103+
-->

0 commit comments

Comments
 (0)