Doctrine\MongoDB\Aggregation\Stage\Project::excludeIdField PHP Метод

excludeIdField() публичный Метод

Shorthand method to exclude the _id field.
public excludeIdField ( boolean $exclude = true )
$exclude boolean
    public function excludeIdField($exclude = true)
    {
        return $this->field('_id')->expression(!$exclude);
    }

Usage Example

Пример #1
0
 public function testProjectStage()
 {
     $projectStage = new Project($this->getTestAggregationBuilder());
     $projectStage->excludeIdField()->includeFields(array('$field', '$otherField'))->field('product')->multiply('$field', 5);
     $this->assertSame(array('$project' => array('_id' => false, '$field' => true, '$otherField' => true, 'product' => array('$multiply' => array('$field', 5)))), $projectStage->getExpression());
 }