solution / mongo-odm-aggregation-bundle
This Bundle integrates mongo aggregation queries into you Symfony2 project.
Installs: 49 076
Dependents: 3
Suggesters: 1
Security: 0
Stars: 12
Watchers: 6
Forks: 3
Open Issues: 2
Type:symfony-bundle
Requires
- php: >=5.4.0
- doctrine/mongodb-odm-bundle: ~3.0
- solution/pipeline-builder: ~0.1
This package is not auto-updated.
Last update: 2024-11-06 13:08:00 UTC
README
Integration Mongo Pipeline Builder into you Doctrine2 Mongo-ODM
Library not yet ready.
###Install
Add to composer and install/update vendors
"solution/mongo-odm-aggregation-bundle": "dev-master"
Add to your AppKernel and install/update vendors
new Solution\MongoAggregationBundle\SolutionMongoAggregationBundle()
###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
bundle created
doctrine_mongodb.odm.default_aggregation_query
etc
####Example create aggregation query
$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);