MongoAggregationBundle
Integration Mongo Pipeline Builder into you Doctrine2 Mongo-ODM, (*1)
Library not yet ready., (*2)
Install
Add to composer and install/update vendors, (*3)
"solution/mongo-odm-aggregation-bundle": "dev-master"
Add to your AppKernel and install/update vendors
``` php
new Solution\MongoAggregationBundle\SolutionMongoAggregationBundle(), (*4)
###Usage
After install, bundle create mongo aggregation query manager for every DocumentManager
Example:
If you have default document manager
doctrine_mongodb.odm.default_document_manager, (*5)
bundle created
doctrine_mongodb.odm.default_aggregation_query, (*6)
etc
####Example create aggregation query
``` php
$expr = new \Solution\MongoAggregation\Pipeline\Operators\Expr;
$aq = $this->get('doctrine_mongodb.odm.default_aggregation_query')
->getCollection('AdmPlayerBundle:Comments')->createAggregateQuery()
->group(['_id' => ['month' => $expr->month('$dateRegistration')], 'count' => $expr->sum(1)])
->sort(['count' => -1])
->limit(50);