Replace MongoDB $ref with referenced object

26 Views Asked by At

I am trying to replace $ref in Mongo with actual objects. I am using doctrine-odm bundle and Symfony as framework.

enter image description here

Above you can see the attributeSet property being a $ref instead of the object it self.

    $query = $this->createAggregationBuilder();

    $query->match()->field('id')->equals($id);

    $query
        ->lookup('AttributeSet')
        ->localField('attributeSet._id')
        ->foreignField('_id')
        ->alias('attributeSet');

    return $query
        ->getAggregation()
        ->getIterator();

My code above is not working and i can not figure out why ( below is output of the code ).

enter image description here

0

There are 0 best solutions below