Skip to content

Commit

Permalink
Fixing MongoDB conditions queries with multiple operators against a s…
Browse files Browse the repository at this point in the history
…ingle field.
  • Loading branch information
nateabele committed Dec 6, 2010
1 parent d2f0f71 commit 552f9e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libraries/lithium/data/source/MongoDb.php
Expand Up @@ -659,8 +659,9 @@ protected function _conditions($conditions, $model, $schema, $context) {
$operations = $result;
break;
}
$operations += $this->_operator($model, $key, $op, $val, $schema);
}
$conditions[$key] = $result;
$conditions[$key] = $operations;
}
return $conditions;
}
Expand Down
6 changes: 6 additions & 0 deletions libraries/lithium/tests/cases/data/source/MongoDbTest.php
Expand Up @@ -622,6 +622,12 @@ public function testNestedObjectCasting() {
$this->assertIdentical(true, $result['notifications']->bar);
$this->assertIdentical(false, $result['notifications']->baz);
}

public function testMultiOperationConditions() {
$conditions = array('loc' => array('$near' => array(50, 50), '$maxDistance' => 5));
$result = $this->db->conditions($conditions, $this->query);
$this->assertEqual($conditions, $result);
}
}

?>

0 comments on commit 552f9e5

Please sign in to comment.