solution / mongo-odm-aggregation-bundle
此包将Mongo聚合查询集成到您的Symfony2项目中。
v0.1.1
2016-04-22 07:39 UTC
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-09-25 12:42:50 UTC
README
将Mongo Pipeline Builder库集成到您的Doctrine2 Mongo-ODM中 Mongo Pipeline Builder
库尚未准备就绪。
### 安装
添加到composer并安装/更新vendor
"solution/mongo-odm-aggregation-bundle": "dev-master"
添加到您的AppKernel并安装/更新vendor
new Solution\MongoAggregationBundle\SolutionMongoAggregationBundle()
### 安装后使用
示例:如果您有默认文档管理器
doctrine_mongodb.odm.default_document_manager
创建bundle
doctrine_mongodb.odm.default_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);