diff --git a/lib/Doctrine/MongoDB/Aggregation/Expr.php b/lib/Doctrine/MongoDB/Aggregation/Expr.php index 7c50a1d3..4f2454e9 100644 --- a/lib/Doctrine/MongoDB/Aggregation/Expr.php +++ b/lib/Doctrine/MongoDB/Aggregation/Expr.php @@ -242,7 +242,7 @@ private function ensureArray($expression) */ public function dateToString($format, $expression) { - return $this->operator('$dateToString', array($format, $expression)); + return $this->operator('$dateToString', array('format' => $format, 'date' => $expression)); } /** diff --git a/tests/Doctrine/MongoDB/Tests/Aggregation/ExprTest.php b/tests/Doctrine/MongoDB/Tests/Aggregation/ExprTest.php index ad006cba..177ce563 100644 --- a/tests/Doctrine/MongoDB/Tests/Aggregation/ExprTest.php +++ b/tests/Doctrine/MongoDB/Tests/Aggregation/ExprTest.php @@ -81,7 +81,7 @@ public function testDateToString() $expr = new Expr(); $this->assertSame($expr, $expr->dateToString('%Y-%m-%d', '$dateField')); - $this->assertSame(array('$dateToString' => array('%Y-%m-%d', '$dateField')), $expr->getExpression()); + $this->assertSame(array('$dateToString' => array('format' => '%Y-%m-%d', 'date' => '$dateField')), $expr->getExpression()); } public function testDayOfMonth()