svn: /phpdoc/en/trunk/reference/mongo/mongocursor/ addoption.xml

From: Date: Mon, 01 Sep 2014 15:01:16 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongocursor/ addoption.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-12760@lists.php.net to get a copy of this message
derick Mon, 01 Sep 2014 15:01:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=334691 Log: PHP-1214: Added the addOption( '$comment', … ) example. Changed paths: U phpdoc/en/trunk/reference/mongo/mongocursor/addoption.xml Modified: phpdoc/en/trunk/reference/mongo/mongocursor/addoption.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongocursor/addoption.xml 2014-09-01 14:11:51 UTC (rev 334690) +++ phpdoc/en/trunk/reference/mongo/mongocursor/addoption.xml 2014-09-01 15:01:16 UTC (rev 334691) @@ -101,6 +101,51 @@ <refsect1 role="examples"> &reftitle.examples; <example> + <title>Adding a comment with <function>MongoCursor::addOption</function> example</title> + <para> + MongoDB supports special options to be send to the server. The shell uses + the <literal>_addSpecial</literal> option to send a + <literal>$comment</literal> to the server. This comment will show up in + the profiling log (for slow queries f.e.). In the PHP driver, you use the + <function>MongoCursor::addOption</function> method. + </para> + <programlisting role="php"> +<![CDATA[ +<?php +$m = new MongoClient; +$c = $m->demo->demo; +$cursor = $c->find(); +$cursor->addOption('$comment', "This comment will show up in the profiling log"); + +foreach ($cursor as $document) { /* empty */ } +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +{ + "op" : "query", + "ns" : "demo.demo", + "query" : { + "$query" : { + + }, + "$comment" : "This comment will show up in the profiling log" + }, + "cursorid" : 168463566447, + "ntoreturn" : 0, + "ntoskip" : 0, + "nscanned" : 101, + "nscannedObjects" : 101, + "keyUpdates" : 0, + "numYield" : 0, +… +]]> + </screen> + </example> + + <example> <title><function>MongoCursor::addOption</function> example</title> <para> Using <function>MongoCursor::skip</function> to skip over millions of

« previous php.doc.cvs (#12760) next »