note 101325 deleted from mongocollection.findone by bjori
| From: | bjori@php.net | Date: | Sun, 02 Sep 2012 12:27:49 +0000 |
| Subject: | note 101325 deleted from mongocollection.findone by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190420@lists.php.net to get a copy of this message | ||
Note Submitter: ejs5 at g2link dot com
----
Special characters seem to be automatically escaped by the Mongo driver.
<?php
$db = $mongo->my_db->wireless_service_providers;
$provider = $db->findOne(array("name" => "AT&T"),
array('_id' => 1));
print_r($provider);
?>
if the value is stored as "AT&T" in the document you will get
Array([_id]=>)
but if the value is stored as "AT&T" it will return
Array ( [_id] => MongoId Object ( ) )