From 325608cb16d4fc602b67a1c1766155b1c57dd3f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9sar=20D=2E=20Rodas?= Date: Wed, 26 May 2010 00:50:12 -0400 Subject: [PATCH] - fixed potential bug with properties(), from now on _id propety is included in all request by default --- lib/ActiveMongo.php | 4 ++++ tests/QueryTest.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lib/ActiveMongo.php b/lib/ActiveMongo.php index ab0d84d..1917fe2 100644 --- a/lib/ActiveMongo.php +++ b/lib/ActiveMongo.php @@ -1689,6 +1689,10 @@ abstract class ActiveMongo implements Iterator, Countable, ArrayAccess unset($props[$id]); } + + /* _id should always be included */ + $props['_id'] = 1; + $this->_properties = $props; return $this; diff --git a/tests/QueryTest.php b/tests/QueryTest.php index 6bc0293..e66f41f 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -138,6 +138,7 @@ class QueryTest extends PHPUnit_Framework_TestCase 'fields' => array( 'a' => 1, 'b' => 1, + '_id' => 1, /* from now on _id is included by default */ ) ); @@ -198,6 +199,7 @@ class QueryTest extends PHPUnit_Framework_TestCase 'fields' => array( 'a' => 1, 'b' => 1, + '_id' => 1, ) ); -- 2.11.4.GIT