I have a mongo class, which I later want to add CRUD functions into it, but as of now I want to write my own collection functions after I created objoect of Mongo, so anytime I want to use mongodb I just create object of my class, and write the commands
but it gives me this error:
Exception raised : Error (2) : "MongoCollection::__construct() expects parameter 1 to be MongoDB, object given
How can I get it as MongoDB,
mongo.class.php
class Mongo
{
public function __construct(){
$this->connect();
}
public function connect{
$this->conn = new \Mongo("mongodb://admin:123456@192.168.2.3);
$this->dbLink = $this->conn->selectDB('profiles');
return $this->dbLink;
}
index.php
$myMongo = new Mongo();
$collection = new MongoCollection($myMongo,'user');