php - mongodb extension is installed but icannot reflect changes in mongoDB console

49

I am using WAMP server 64bit as well as mongoDB 64 bit in my windows 7 machine. I have successfully configured mongoDB on wamp server where php_info() page shows MongoDB Support Version 1.3.2RC1 enabled.But the problem faced by me is whenever I establish connection with mongoDB in php code the code runs but it does not reflect the changes in mongoDB console.Y is this so?

<?php
$connection = new MongoClient();
//$db = $connection->sample;

// select a collection:
//$collection = $db->first;
$collection = $connection->sample->test1;

$doc = array(
"name" => "MDB",
"type" => "database",
"count" => 2,
"info" => (object)array( "x" => 203, "y" => 102),
"versions" => array("0.9.7", "0.9.8", "0.9.9")
);

$collection->insert( $doc );

echo "Inserted successfully....";

$document = $collection->findOne();
var_dump( $document );

?>

the above code retrieves the inserted document as it is on browser.But in mongo.exe console there is no data inserted. My default database is 'db'

People are also looking for solutions to the problem: PHP: Generate dynamic sized image based on string

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.