PHP code example of solution / mongo-odm-aggregation-bundle
1. Go to this page and download the library: Download solution/mongo-odm-aggregation-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
solution / mongo-odm-aggregation-bundle example snippets
php
new Solution\MongoAggregationBundle\SolutionMongoAggregationBundle()
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);