php-doc-en/reference/mongo/mongoresultexception/getdocument.xml
Hannes Magnusson 36c5526571 Document new exceptions
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332960 c90b9560-bf6c-de11-be94-00142212c4b1
2014-03-11 21:45:16 +00:00

134 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongoresultexception.getdocument" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoResultException::getDocument</refname>
<refpurpose>Retrieve the full result document</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>MongoResultException::getDocument</methodname>
<void />
</methodsynopsis>
<para>
Retrieves the full error result document.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The full result document as an array, including partial data if available and
additional keys.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="mongoresultexception.getdocument.example.basic">
<title><methodname>MongoResultException::getDocument</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
$mc = new MongoClient("localhost");
$c = $mc->selectCollection("test", "test");
$c->insert(array(
"name" => "Next promo",
"inprogress" => false,
"priority" => 0,
"tasks" => array( "select product", "add inventory", "do placement"),
) );
$c->insert(array(
"name" => "Biz report",
"inprogress" => false,
"priority" => 1,
"tasks" => array( "run sales report", "email report" )
) );
$c->insert(array(
"name" => "Biz report",
"inprogress" => false,
"priority" => 2,
"tasks" => array( "run marketing report", "email report" )
),
array("w" => true)
);
try {
$retval = $c->findAndModify(
array("inprogress" => false, "name" => "Biz report"),
array('$set' => array('$set' => array('inprogress' => true, "started" => new MongoDate()))),
null,
array(
"sort" => array("priority" => -1),
"new" => true,
)
);
} catch(MongoResultException $e) {
echo $e->getMessage(), "\n";
$res = $e->getDocument();
var_dump($res);
}
?>
]]>
</programlisting>
&examples.outputs.similar;
<screen>
<![CDATA[
$set is not valid for storage.
array(3) {
["lastErrorObject"]=>
array(5) {
["connectionId"]=>
int(6)
["err"]=>
string(30) "$set is not valid for storage."
["code"]=>
int(52)
["n"]=>
int(0)
["ok"]=>
float(1)
}
["ok"]=>
float(0)
["errmsg"]=>
string(30) "$set is not valid for storage."
}
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->