Answer the question
In order to leave comments, you need to log in
How to fix Detected corrupt BSON data error?
made a request in the console
db.company.aggregate([{$group : {_id : {$substr: ["$name", 0,1]}}}])
$collection = Yii::$app->mongodb->getCollection('company');
$result = $collection->aggregate(array(
array(
'$group' => array(
'_id' => array('$substr' => ['$name', 0, 1]),
),
),
)
);
$this->document = $this->db->getQueryBuilder()->aggregate($collectionName, $pipelines, $options);
$cursor = $this->execute();
$result = current($cursor->toArray());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question