svn: /phpdoc/en/trunk/reference/mongo/mongodb/ listcollections.xml

From: Date: Thu, 11 Sep 2014 11:50:19 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongodb/ listcollections.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-12798@lists.php.net to get a copy of this message
derick Thu, 11 Sep 2014 11:50:19 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=334840 Log: Changed example to be non-destructive. Changed paths: U phpdoc/en/trunk/reference/mongo/mongodb/listcollections.xml Modified: phpdoc/en/trunk/reference/mongo/mongodb/listcollections.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongodb/listcollections.xml 2014-09-11 11:43:24 UTC (rev 334839) +++ phpdoc/en/trunk/reference/mongo/mongodb/listcollections.xml 2014-09-11 11:50:19 UTC (rev 334840) @@ -68,20 +68,19 @@ <example> <title><function>MongoDB::listCollections</function> example</title> <para> - The following example demonstrates dropping each collection in a database. + The following example demonstrates running count on each collection in a database. </para> <programlisting role="php"> <![CDATA[ <?php $m = new MongoClient(); -$db = $m->selectDB("sample"); +$db = $m->selectDB("demo"); $list = $db->listCollections(); foreach ($list as $collection) { - echo "removing $collection... "; - $collection->drop(); - echo "gone\n"; + echo "amount of documents in $collection: "; + echo $collection->count(), "\n"; } ?> @@ -90,10 +89,11 @@ &example.outputs.similar; <screen> <![CDATA[ -removing sample.blog.posts... gone -removing sample.critical.docs... gone -removing sample.taxes... gone ... +amount of documents in demo.pubs: 4 +amount of documents in demo.elephpants: 3 +amount of documents in demo.cities: 22840 +... ]]> </screen> </example>

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