<?php
$m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$c = new MongoDB\Driver\Command( [ 'drop' => 'test' ] );
$cursor = $m->executeCommand( 'demo', $c );
$doc = [
'string' => 'bar',
'number_i' => 55,
'number_l' => 12345678901234567,
'bool' => true,
'null' => null,
'float' => M_PI,
];
$bw = new MongoDB\Driver\BulkWrite();
$bw->insert( 'demo.test', $doc );
$m->executeBulkWrite( 'demo.test', $bw );
$q = new MongoDB\Driver\Query( [] );
$cursor = $m->executeQuery( 'demo.test', $q );
foreach ( $cursor as $key => $result )
{
print_r( $result );
}
?>