I have a mongodb connection making class which I cannot modify for some reason. It gives me a reference to a target mongodb collection in which I can do operations . eg.
$myColl = mongoConnect::targetCollection($key);
$myColl->insert( array("_id" => "SDFWERWER" ,"data" =&g开发者_运维问答t; 42 ));
// How can I get a reference to the DATABASE using $myColl, so that I can use some
// command like :
$myDb->command(); <--- some DB reference like this.
EDIT : i got it , $myColl->db gives reference to db value in PHP driver :)
See the PHP driver documentation for the Collection class
It shows there is a public field containing a reference to the DB ($db).
Hope this helps!
精彩评论