solution/mongo-odm-aggregation-bundle

此包将Mongo聚合查询集成到您的Symfony2项目中。

安装次数: 48,559

依赖项: 3

建议者: 1

安全: 0

星级: 12

关注者: 6

分支: 3

公开问题: 2

类型:symfony-bundle

v0.1.1 2016-04-22 07:39 UTC

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);