Attempted to call an undefined method named "allowDiskUse" of class "DoctrineODMMongoDBAggregationBuilder

I am trying to get last purchases with item, location and batch. So I tried to get ids of each by grouping. I can’t use group command because it is huge data and can not be handle by group command.

 $builder = $dManager->createAggregationBuilder('UserPurchases');        
        ->skip($skip)->limit($limit)    ;
$purchase = $builder->execute();

My Expected result is

Item Name, Location, Batch, Last purchased quantity.

Source: Symfony Questions