我們已經安裝了php mongo ext,然後設置了作曲者。php 7 mongodb集合插入
https://github.com/alcaeus/mongo-php-adapter
在我的PHP代碼中,我這樣的:
require_once 'vendor/autoload.php';
$m = new MongoDB\Client("mongodb://host1,host2", array ('replicaSet' => 'host-set-01'));
$document = array(....);
$db->mycollection->insert($document);
而且它返回此錯誤:
PHP Fatal error: Uncaught Error: Call to undefined method MongoDB\Collection::insert()
但是適配器的文件夾裏面我看到insert()
該集合內class Mongo/MongoCollection.php
任何人都可以使用mongodb/adapter嗎?
您能否爲此問題發佈正確的修補程序? – Nadeshwaran