[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/mongo/_mongocommandcursor/info.xml_mongocursor/i
From:       Jeremy_Mikola <jmikola () php ! net>
Date:       2014-12-28 21:54:15
Message-ID: svn-jmikola-1419803655-335440-1730916995 () svn ! php ! net
[Download RAW message or body]

jmikola                                  Sun, 28 Dec 2014 21:54:15 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=335440

Log:
Revise docs and examples for MongoCursor::info()

Changed paths:
    U   phpdoc/en/trunk/reference/mongo/mongocommandcursor/info.xml
    U   phpdoc/en/trunk/reference/mongo/mongocursor/info.xml

Modified: phpdoc/en/trunk/reference/mongo/mongocommandcursor/info.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongocommandcursor/info.xml	2014-12-28 21:13:19 \
                UTC (rev 335439)
+++ phpdoc/en/trunk/reference/mongo/mongocommandcursor/info.xml	2014-12-28 21:54:15 \
UTC (rev 335440) @@ -4,7 +4,7 @@
 <refentry xml:id="mongocommandcursor.info" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>MongoCommandCursor::info</refname>
-  <refpurpose>Gets the query, fields, limit, and skip for this cursor</refpurpose>
+  <refpurpose>Gets information about the cursor's creation and \
iteration</refpurpose>  </refnamediv>

  <refsect1 role="description">
@@ -14,7 +14,7 @@
    <void/>
   </methodsynopsis>
   <para>
-   This can be called before or after the query.
+   This can be called before or after the cursor has started iterating.
   </para>
  </refsect1>

@@ -24,10 +24,11 @@
  </refsect1>

  <refsect1 role="returnvalues">
-  &reftitle.returnvalues;
+  &reftitle.returnvalues;
   <para>
-   Returns the namespace, limit, skip, query, fields, connection and iteration
-   information for this cursor.
+   Returns the namespace, batch size, limit, skip, flags, query, and projected
+   fields for this cursor. If the cursor has started iterating, additional
+   information about iteration and the connection will be included.
   </para>
  </refsect1>

@@ -39,18 +40,21 @@
 <![CDATA[
 <?php
 $m = new MongoClient();
-$c = $m->test->test;
-$cursor = $c->commandCursor( [
-    'aggregate' => 'test',
-    'pipeline' => [
-        [ '$match' => [ '_id' => [ '$exists' => true ] ] ],
+
+$cursor = new MongoCommandCursor(
+    $m, // MongoClient object
+    'demo.cities', // namespace
+    [
+        'aggregate' => 'cities',
+        'pipeline' => [ [ '$match' => [ '_id' => [ '$exists' => true ] ] ] ],
+        'cursor' => [ 'batchSize' => 1 ],
     ]
-] );
+);

 echo "Before iteration started:\n";
 var_dump($cursor->info());

-echo "Aftere iteration started:\n";
+echo "\nAfter iteration started:\n";
 $cursor->rewind();
 var_dump($cursor->info());

@@ -62,97 +66,103 @@
 <![CDATA[
 Before iteration started:
 array(8) {
-  'ns' =>
-  string(9) "test.test"
-  'limit' =>
+  ["ns"]=>
+  string(11) "demo.cities"
+  ["limit"]=>
   int(0)
-  'batchSize' =>
+  ["batchSize"]=>
   int(0)
-  'skip' =>
+  ["skip"]=>
   int(0)
-  'flags' =>
+  ["flags"]=>
   int(0)
-  'query' =>
-  array(2) {
-    'aggregate' =>
-    string(4) "test"
-    'pipeline' =>
+  ["query"]=>
+  array(3) {
+    ["aggregate"]=>
+    string(6) "cities"
+    ["pipeline"]=>
     array(1) {
-      [0] =>
+      [0]=>
       array(1) {
-        '$match' =>
+        ["$match"]=>
         array(1) {
-          '_id' =>
+          ["_id"]=>
           array(1) {
-            '$exists' =>
+            ["$exists"]=>
             bool(true)
           }
         }
       }
     }
+    ["cursor"]=>
+    array(1) {
+      ["batchSize"]=>
+      int(1)
+    }
   }
-  'fields' =>
+  ["fields"]=>
   NULL
-  'started_iterating' =>
+  ["started_iterating"]=>
   bool(false)
 }
-Aftere iteration started:
+
+After iteration started:
 array(17) {
-  'ns' =>
-  string(9) "test.test"
-  'limit' =>
+  ["ns"]=>
+  string(11) "demo.cities"
+  ["limit"]=>
   int(0)
-  'batchSize' =>
-  int(101)
-  'skip' =>
+  ["batchSize"]=>
   int(0)
-  'flags' =>
+  ["skip"]=>
   int(0)
-  'query' =>
+  ["flags"]=>
+  int(0)
+  ["query"]=>
   array(3) {
-    'aggregate' =>
-    string(4) "test"
-    'pipeline' =>
+    ["aggregate"]=>
+    string(6) "cities"
+    ["pipeline"]=>
     array(1) {
-      [0] =>
+      [0]=>
       array(1) {
-        '$match' =>
+        ["$match"]=>
         array(1) {
-          '_id' =>
+          ["_id"]=>
           array(1) {
-            '$exists' =>
+            ["$exists"]=>
             bool(true)
           }
         }
       }
     }
-    'cursor' =>
+    ["cursor"]=>
     array(1) {
-      'batchSize' =>
-      int(101)
+      ["batchSize"]=>
+      int(1)
     }
   }
-  'fields' =>
+  ["fields"]=>
   NULL
-  'started_iterating' =>
+  ["started_iterating"]=>
   bool(true)
-  'id' =>
+  ["id"]=>
+  int(185840310129)
+  ["at"]=>
   int(0)
-  'at' =>
+  ["numReturned"]=>
   int(0)
-  'numReturned' =>
-  int(0)
-  'server' =>
-  string(24) "localhost:27017;-;.;2316"
-  'host' =>
+  ["server"]=>
+  string(25) "localhost:27017;-;.;23991"
+  ["host"]=>
   string(9) "localhost"
-  'port' =>
+  ["port"]=>
   int(27017)
-  'connection_type_desc' =>
+  ["connection_type_desc"]=>
   string(10) "STANDALONE"
-  'firstBatchAt' =>
+  ["firstBatchAt"]=>
   int(0)
-  'firstBatchNumReturned' =>
+  ["firstBatchNumReturned"]=>
   int(1)
 }
 ]]>

Modified: phpdoc/en/trunk/reference/mongo/mongocursor/info.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongocursor/info.xml	2014-12-28 21:13:19 UTC (rev \
                335439)
+++ phpdoc/en/trunk/reference/mongo/mongocursor/info.xml	2014-12-28 21:54:15 UTC (rev \
335440) @@ -4,7 +4,7 @@
 <refentry xml:id="mongocursor.info" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>MongoCursor::info</refname>
-  <refpurpose>Gets the query, fields, limit, and skip for this cursor</refpurpose>
+  <refpurpose>Gets information about the cursor's creation and \
iteration</refpurpose>  </refnamediv>

  <refsect1 role="description">
@@ -14,7 +14,7 @@
    <void/>
   </methodsynopsis>
   <para>
-   This can be called before or after the query.
+   This can be called before or after the cursor has started iterating.
   </para>
  </refsect1>

@@ -26,7 +26,9 @@
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-   Returns the namespace, limit, skip, query, and fields for this cursor.
+   Returns the namespace, batch size, limit, skip, flags, query, and projected
+   fields for this cursor. If the cursor has started iterating, additional
+   information about iteration and the connection will be included.
   </para>
  </refsect1>

@@ -74,24 +76,35 @@
    <programlisting role="php">
 <![CDATA[
 <?php
+$m = new MongoClient();

-$m = new MongoClient();
-$cursor = $m->foo->bar->find(array("x" => 4), array("y" => false));
+$cursor = $m->test->foo->find(array("x" => 4), array("y" => 0));
+
+echo "Before iteration started:\n";
 var_dump($cursor->info());

+echo "\nAfter iteration started:\n";
+$cursor->rewind();
+var_dump($cursor->info());
+
 ?>
 ]]>
    </programlisting>
    &example.outputs.similar;
    <screen>
 <![CDATA[
-array(5) {
+Before iteration started:
+array(8) {
   ["ns"]=>
-  string(7) "foo.bar"
+  string(8) "test.foo"
   ["limit"]=>
   int(0)
+  ["batchSize"]=>
+  int(0)
   ["skip"]=>
   int(0)
+  ["flags"]=>
+  int(0)
   ["query"]=>
   array(1) {
     ["x"]=>
@@ -102,7 +115,49 @@
     ["y"]=>
     int(0)
   }
+  ["started_iterating"]=>
+  bool(false)
 }
+
+After iteration started:
+array(15) {
+  ["ns"]=>
+  string(8) "test.foo"
+  ["limit"]=>
+  int(0)
+  ["batchSize"]=>
+  int(0)
+  ["skip"]=>
+  int(0)
+  ["flags"]=>
+  int(0)
+  ["query"]=>
+  array(1) {
+    ["x"]=>
+    int(4)
+  }
+  ["fields"]=>
+  array(1) {
+    ["y"]=>
+    int(0)
+  }
+  ["started_iterating"]=>
+  bool(true)
+  ["id"]=>
+  int(0)
+  ["at"]=>
+  int(0)
+  ["numReturned"]=>
+  int(1)
+  ["server"]=>
+  string(25) "localhost:27017;-;.;26450"
+  ["host"]=>
+  string(9) "localhost"
+  ["port"]=>
+  int(27017)
+  ["connection_type_desc"]=>
+  string(10) "STANDALONE"
+}
 ]]>
    </screen>
   </example>



-- 
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