mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Changed example to be non-destructive.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334840 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
2bf617982f
commit
6133457550
1 changed files with 8 additions and 8 deletions
|
@ -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,9 +89,10 @@ foreach ($list as $collection) {
|
|||
&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>
|
||||
|
|
Loading…
Reference in a new issue