We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 412c2d3 commit 4ef8b30Copy full SHA for 4ef8b30
listCollections.php
@@ -0,0 +1,22 @@
1
+<?php
2
+
3
+require "tests/bootstrap.php";
4
5
+use MongoDB\Driver\Command;
6
+use MongoDB\Driver\Manager;
7
+use MongoDB\Driver\ReadPreference;
8
+use MongoDB\Model\CollectionInfoCommandIterator;
9
10
+$command = new Command(array('listCollections' => 1));
11
+$readPreference = new ReadPreference(ReadPreference::RP_PRIMARY);
12
13
+$manager = new Manager('mongodb://127.0.0.1');
14
+$result = $manager->executeCommand('phplib_test', $command, $readPreference);
15
16
+$iterator = new CollectionInfoCommandIterator($result);
17
18
+foreach ($iterator as $value) {
19
+ echo $collection->getName(), "\n";
20
+}
21
22
+echo "===DONE===\n";
0 commit comments