Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
php :: Agregación ::$avg:: ¿Resultado indefinido en :: mongodb?

esta es la agregación de funciones

 $query =$et->aggregate( [ [ '$match' => [ 'operasi' => '"INSERT"' ] ], [ '$group' => [ '_id' => '$record', 'avg' => [ '$avg' => '$extime' ] ] ], ['$sort' => ["_id" => 1]] ]);`

esta sintaxis para mostrar el resultado

 $rows1 = array(); $rows1['name'] = 'Mongodb'; foreach ($query as $row) { echo $rows1['data'][]=$row['avg']; }

luego ejecuta:

 Notice: Undefined index: avg in E:\xampp\htdocs\RISET\result\insert.php on line 40

este resultado con var_dump($query);

 array(3) { ["waitedMS"]=> int(0) ["result"]=> array(3) { [0]=> array(2) { ["_id"]=> string(2) "10" ["avg"]=> float(0.26921399434408) } [1]=> array(2) { ["_id"]=> string(3) "100" ["avg"]=> float(0.7808530330658) } [2]=> array(2) { ["_id"]=> string(6) "100000" ["avg"]=> float(85.200194120407) } } ["ok"]=> float(1) }

¿Qué tengo que hacer?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!