0
這example顯示了一個簡單的插入:點標記在蒙戈用PHP驅動
$collection = (new MongoDB\Client)->example->users;
$insertOneResult = $collection->insertOne([
'username' => 'admin',
'email' => '[email protected]',
'name' => 'Admin User',
]);
printf("Inserted %d document(s)\n", $insertOneResult->getInsertedCount());
var_dump($insertOneResult->getInsertedId());
...但採用了最新的PHP驅動程序,我得到一個錯誤,如果我在集合名稱.
(collection.attribute
) ,例如:
$collection = (new MongoDB\Client)->collection.attribute->users;