This code will not find a record based on an ID search
<?php
$userid = $_GET['id'];
$theObjId = new MongoId($userid);
$connection = new Mongo('localhost');
$db = $connection->test->items;
$item = $db->findOne(array('_id' => $theObjId));
echo 'Item: ' . $item . '<br>';
echo 'UserID: ' . $userid . '<br>';
echo 'TheObjID: ' . $theObjId;
$connection->close();
?>
$userid is supplied by a form in another .php file
This is the output ....
$item: Array
$userid: 4e0dfc8e7bfb8bac12000000
$theObjId: 4e0dfc8e7bfb8bac12000000
the output proves my variables contain the ID