public function connect($server) { $this->connection = new \MongoDB\Client($server); $this->db = $this->connection->selectDatabase($this->dbName); $this->collection = $this->connection->selectCollection($this->dbName, $this->dbName); }