From c99ec713a9eb70047f34b999dc10e00a56a36536 Mon Sep 17 00:00:00 2001 From: Christopher Buchino Date: Mon, 2 Jul 2012 13:02:39 -0400 Subject: [PATCH] fixed bug when doing findAndModify where result is not set unless debug is on --- models/datasources/mongodb_source.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/models/datasources/mongodb_source.php b/models/datasources/mongodb_source.php index f9d36ba..73cd674 100644 --- a/models/datasources/mongodb_source.php +++ b/models/datasources/mongodb_source.php @@ -961,16 +961,17 @@ public function read(&$Model, $query = array()) { )); $return = $this->_db ->command($options); - if ($this->fullDebug) { - if ($return['ok']) { - $count = 1; - if ($this->config['set_string_id'] && !empty($return['value']['_id']) && is_object($return['value']['_id'])) { - $return['value']['_id'] = $return['value']['_id']->__toString(); - } - $return[][$Model->alias] = $return['value']; - } else { - $count = 0; + if ($return['ok']) { + $count = 1; + if ($this->config['set_string_id'] && !empty($return['value']['_id']) && is_object($return['value']['_id'])) { + $return['value']['_id'] = $return['value']['_id']->__toString(); } + $return[][$Model->alias] = $return['value']; + } else { + $count = 0; + } + + if ($this->fullDebug) { $this->logQuery("db.runCommand( :options )", array('options' => array_filter($options), 'count' => $count) );