note 100386 added to class.mongoid

From: Date: Tue, 12 Oct 2010 19:23:25 +0000
Subject: note 100386 added to class.mongoid
Groups: php.notes 
Request: Send a blank email to php-notes+get-173174@lists.php.net to get a copy of this message
this is useful for querying for an object by id, given the id's hex: <?php $userid = 4cb4ab6d7addf98506010000; $theObjId = new MongoId($userid); $connection = new Mongo(); $db = $connection->thedb->users; // this will return our matching entry. $item = $db->findOne(array("_id" => $theObjId)); $connection->close(); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 85.180.30.195 ---- Manual Page -- http://www.php.net/manual/en/class.mongoid.php Edit -- https://master.php.net/note/edit/100386 Del: integrated -- https://master.php.net/note/delete/100386/integrated Del: useless -- https://master.php.net/note/delete/100386/useless Del: bad code -- https://master.php.net/note/delete/100386/bad+code Del: spam -- https://master.php.net/note/delete/100386/spam Del: non-english -- https://master.php.net/note/delete/100386/non-english Del: in docs -- https://master.php.net/note/delete/100386/in+docs Del: other reasons-- https://master.php.net/note/delete/100386 Reject -- https://master.php.net/note/reject/100386 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173174) next »