<?php
$m = new MongoClient();
$testDb = $m->selectDb('test');
// get MongoCollection. It's kind of a db table
$coll = $testDb->selectCollection('my_table');
// insert data. Forget what you know about columns
// or db schemas. This just inserts the data
$success = $coll->insert([
'name' => 'myname',
'value' => 'myvalue',
'object' => new ArrayObject(),
]);
dump($success);
^ array:4 [
"n" => 0
"connectionId" => 9
"err" => null
"ok" => 1.0
]