Connect to mongodb in PHP

$connection = new Mongo( “localhost:27017” ); 
$collection = $connection->mydb->mycollection; 
$cursor = $collection->find();
foreach ($cursor as $id => $value) {
    echo “$id: “;
    var_dump( $value ); 
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.