March 2019
Intermediate to advanced
394 pages
11h 4m
English
The following command will insert a single $document that contains an array of two key/value pairs, with the key names of isbn and name:
$document = array( "isbn" => "401", "name" => "MongoDB and PHP" );$result = $collection->insertOne($document);var_dump($result);
The output from the var_dump($result) command is shown as follows:
MongoDB\InsertOneResult Object( [writeResult:MongoDB\InsertOneResult:private] => MongoDB\Driver\WriteResult Object ( [nInserted] => 1 [nMatched] => 0 [nModified] => 0 [nRemoved] => 0 [nUpserted] => 0 [upsertedIds] => Array ( ) [writeErrors] => Array ( ) [writeConcernError] => [writeConcern] => MongoDB\Driver\WriteConcern Object ( ) ) [insertedId:MongoDB\InsertOneResult:private] => MongoDB\BSON\ObjectID ...
Read now
Unlock full access