Created
May 3, 2015 19:33
-
-
Save DMcP89/a72c3e93a13ae836119b to your computer and use it in GitHub Desktop.
PHP mongoDB connection check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dbhost = "mongodb://localhost:27017"; | |
$dbConnection = new MongoClient($dbhost); | |
$db = $dbConnection->test; | |
$collection = $db->testData; | |
$document = array("name" => "PHP Insert"); | |
$collection->insert($document); | |
$results = $collection->findOne(array("_id" => $document['_id'])); | |
$resultValue = $results['name']; | |
print "Query Results: $resultValue \n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment