Alcaeus\MongoDbAdapter\AbstractCursor::__construct PHP Method

__construct() public method

Create a new cursor
public __construct ( MongoClient $connection, string $ns )
$connection MongoClient Database connection.
$ns string Full name of database and collection.
    public function __construct(\MongoClient $connection, $ns)
    {
        $this->connection = $connection;
        $this->ns = $ns;
        $nsParts = explode('.', $ns);
        $dbName = array_shift($nsParts);
        $collectionName = implode('.', $nsParts);
        $this->db = $connection->selectDB($dbName)->getDb();
        if ($collectionName) {
            $this->collection = $connection->selectCollection($dbName, $collectionName)->getCollection();
        }
    }

Usage Example

 /**
  * MongoCommandCursor constructor.
  * @param MongoClient $connection
  * @param string $ns
  * @param array $command
  */
 public function __construct(MongoClient $connection, $ns, array $command = [])
 {
     parent::__construct($connection, $ns);
     $this->command = $command;
 }
All Usage Examples Of Alcaeus\MongoDbAdapter\AbstractCursor::__construct