Агрегация в БД Mongo с использованием phpPhp

Кемеровские программисты php общаются здесь
Anonymous
Агрегация в БД Mongo с использованием php

Сообщение Anonymous »


I'm trying to get the aggregate of a column in a document collection in mongo DB this is my code.

public function aggregate($columnName, $projection, $collectionName) { // database name $dbName = $this->dbHandler->inioluwa; // database collection $dbCollection = $dbName->$collectionName; // return the collection data return $dbCollection->aggregate([['$limit' => $projection], ['$group' => ['_id' => null, 'average' => ['$avg' => '$' . $columnName]]]]); } i was unable to get any result. after inserting the necessary parameters.


Источник: https://stackoverflow.com/questions/780 ... -using-php

Вернуться в «Php»