Skip to content

Commit 80466c1

Browse files
committed
[wip] listCollections iteration returns no results
1 parent 4daccd7 commit 80466c1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

listCollections.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)