【发布时间】:2018-07-24 22:59:51
【问题描述】:
我正在尝试转换代码以访问 MongoDB using MongoDB\Driver\Manager: latest MongoDB extension of PHP,但遇到了一些困难。确实,在我看来,这个新驱动程序与以前的驱动程序相比有点低级,因此使用起来可能有点复杂......:
$mongoConn = new MongoClient("mongodb://localhost:27017");
$mongoDB = $mongoConn->selectDataBase(dbname1);//dbname2 exists too
...
$index = new MongoDBIndexation($mongoDB);//our class for using
如果可以,我必须开始:
$mongoConn = new MongoDB\Driver\Manager("mongodb://localhost:27017");
请问如何继续使用 $mongoDB?
什么是等价物:
$collection->remove
$collection->save and
$collection->findOne ?
提前致谢
【问题讨论】: