svn: /phpdoc/en/trunk/reference/mongo/ tutorial.xml

From: Date: Thu, 29 Nov 2012 16:20:34 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/ tutorial.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-10813@lists.php.net to get a copy of this message
derick Thu, 29 Nov 2012 16:20:34 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=328572 Log: Bug #63333: %s/$obj/$document Bug: https://bugs.php.net/63333 (Open) PHP should return documents as objects, not arrays. Changed paths: U phpdoc/en/trunk/reference/mongo/tutorial.xml Modified: phpdoc/en/trunk/reference/mongo/tutorial.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/tutorial.xml 2012-11-29 14:01:18 UTC (rev 328571) +++ phpdoc/en/trunk/reference/mongo/tutorial.xml 2012-11-29 16:20:34 UTC (rev 328572) @@ -25,19 +25,19 @@ $collection = $db->cartoons; // add a record -$obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" ); -$collection->insert($obj); +$document = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" ); +$collection->insert($document); // add another record, with a different "shape" -$obj = array( "title" => "XKCD", "online" => true ); -$collection->insert($obj); +$document = array( "title" => "XKCD", "online" => true ); +$collection->insert($document); // find everything in the collection $cursor = $collection->find(); // iterate through the results -foreach ($cursor as $obj) { - echo $obj["title"] . "\n"; +foreach ($cursor as $document) { + echo $document["title"] . "\n"; } ?> @@ -241,8 +241,8 @@ $connection = new MongoClient(); $collection = $connection->database->collectionName; -$obj = $collection->findOne(); -var_dump( $obj ); +$document = $collection->findOne(); +var_dump( $document ); ?> ]]> </programlisting>

« previous php.doc.cvs (#10813) next »