[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/_executecommand.x
From: Jeremy_Mikola <jmikola () php ! net>
Date: 2018-05-18 19:12:22
Message-ID: svn-jmikola-1526670742-345032-1557758245 () svn ! php ! net
[Download RAW message or body]
jmikola Fri, 18 May 2018 19:12:22 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=345032
Log:
Add maxTimeMS examples for executeQuery and executeCommand
https://jira.mongodb.org/browse/PHPC-585
Changed paths:
U phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executecommand.xml
U phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executequery.xml
Modified: phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executecommand.xml
===================================================================
--- phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executecommand.xml 2018-05-17 \
13:52:48 UTC (rev 345031)
+++ phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executecommand.xml 2018-05-18 \
19:12:22 UTC (rev 345032) @@ -202,6 +202,44 @@
]]>
</screen>
</example>
+
+ <example>
+ <title>Limiting execution time for a command</title>
+ <para>
+ The execution time of a command may be limited by specifying a value for
+ <literal>"maxTimeMS"</literal> in the
+ <classname>MongoDB\Driver\Command</classname> document. Note that this time
+ limit is enforced on the server side and does not take network latency into
+ account. See
+ <link xlink:href="&url.mongodb.docs.maxtimems;">Terminate Running \
Operations</link> + in the MongoDB manual for more information.
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$manager = new MongoDB\Driver\Manager('mongodb://localhost:27017');
+
+$command = new MongoDB\Driver\Command([
+ 'count' => 'collection',
+ 'query' => ['x' => ['$gt' => 1]],
+ 'maxTimeMS' => 1000,
+]);
+
+$cursor = $manager->executeCommand('db', $command);
+
+var_dump($cursor->toArray()[0]);
+
+?>
+]]>
+ </programlisting>
+ <para>
+ If the command fails to complete after one second of execution time on the
+ server, a
+ <classname>MongoDB\Driver\Exception\ExecutionTimeoutException</classname>
+ will be thrown.
+ </para>
+ </example>
</refsect1>
<refsect1 role="notes">
Modified: phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executequery.xml
===================================================================
--- phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executequery.xml 2018-05-17 \
13:52:48 UTC (rev 345031)
+++ phpdoc/en/trunk/reference/mongodb/mongodb/driver/manager/executequery.xml 2018-05-18 \
19:12:22 UTC (rev 345032) @@ -139,6 +139,45 @@
]]>
</screen>
</example>
+
+ <example>
+ <title>Limiting execution time for a query</title>
+ <para>
+ The <literal>"maxTimeMS"</literal>
+ <classname>MongoDB\Driver\Query</classname> option may be used to limit the
+ execution time of a query. Note that this time limit is enforced on the
+ server side and does not take network latency into account. See
+ <link xlink:href="&url.mongodb.docs.maxtimems;">Terminate Running \
Operations</link> + in the MongoDB manual for more information.
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$manager = new MongoDB\Driver\Manager('mongodb://localhost:27017');
+
+$filter = ['x' => ['$gt' => 1]];
+$options = [
+ 'maxTimeMS' => 1000,
+];
+
+$query = new MongoDB\Driver\Query($filter, $options);
+$cursor = $manager->executeQuery('db.collection', $query);
+
+foreach ($cursor as $document) {
+ var_dump($document);
+}
+
+?>
+]]>
+ </programlisting>
+ <para>
+ If the query fails to complete after one second of execution time on the
+ server, a
+ <classname>MongoDB\Driver\Exception\ExecutionTimeoutException</classname>
+ will be thrown.
+ </para>
+ </example>
</refsect1>
<refsect1 role="seealso">
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic