Permalink
Browse files

Merge pull request #286 from mauroaccornero/17_01_20_sample_stage_fix

Fixed  sample stage
  • Loading branch information...
2 parents 293ad1e + 53afc96 commit f8fa1bc912388310483277a0f0cff976f286c6e4 @alcaeus alcaeus committed on GitHub Jan 20, 2017
@@ -52,7 +52,7 @@ public function __construct(Builder $builder, $size)
public function getExpression()
{
return [
- '$sample' => $this->size
+ '$sample' => ['size' => $this->size]
];
}
}
@@ -32,7 +32,7 @@ public function testGetPipeline()
'group' => ['$in' => ['a', 'b']]
]
],
- ['$sample' => 10],
+ ['$sample' => ['size' => 10]],
['$lookup' =>
[
'from' => 'orders',
@@ -13,14 +13,14 @@ public function testSampleStage()
{
$sampleStage = new Sample($this->getTestAggregationBuilder(), 10);
- $this->assertSame(['$sample' => 10], $sampleStage->getExpression());
+ $this->assertSame(['$sample' => ['size' => 10]], $sampleStage->getExpression());
}
public function testSampleFromBuilder()
{
$builder = $this->getTestAggregationBuilder();
$builder->sample(10);
- $this->assertSame([['$sample' => 10]], $builder->getPipeline());
+ $this->assertSame([['$sample' => ['size' => 10]]], $builder->getPipeline());
}
}

0 comments on commit f8fa1bc

Please sign in to comment.