Doctrine\MongoDB\Connection::selectCollection PHP Method

selectCollection() public method

Wrapper method for MongoClient::selectCollection().
See also: http://php.net/manual/en/mongoclient.selectcollection.php
public selectCollection ( string $db, string $collection ) : Doctrine\MongoDB\Collection
$db string
$collection string
return Doctrine\MongoDB\Collection
    public function selectCollection($db, $collection)
    {
        $this->initialize();
        return $this->selectDatabase($db)->selectCollection($collection);
    }

Usage Example

 public function testDriverOptions()
 {
     if (!extension_loaded('mongo')) {
         $this->markTestSkipped('Test will not work with polyfills for ext-mongo');
     }
     $callCount = 0;
     $streamContext = stream_context_create(['mongodb' => ['log_cmd_delete' => function () use(&$callCount) {
         $callCount++;
     }]]);
     $connection = new Connection(null, [], null, null, ['context' => $streamContext]);
     $connection->selectCollection('test', 'collection')->remove([]);
     $this->assertSame(1, $callCount);
 }
All Usage Examples Of Doctrine\MongoDB\Connection::selectCollection