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

333
Views
$pipeline no es una lista (índice inesperado: "$grupo") en Laravel

Cuando se ejecuta la siguiente consulta, los resultados se muestran en mongo Shell.

Registros de muestra

 { "_id" : ObjectId("587e21df6e79d255011a9c6a"), "vendor_id" : "101", "subscription_id" : 14, "created_at" : ISODate("2017-01-17T13:53:35.272Z") } { "_id" : ObjectId("587e21df6e79d255011a9c6c"), "vendor_id" : "102", "subscription_id" : 14, "created_at" : ISODate("2017-01-17T13:56:35.272Z") }

Consulta

 db.user_config.aggregate({$group: { _id : "$subscription_id", list: { $push: { _id: "$_id", vendor_id: "$vendor_id" } } }})

Resultados

 /* 1 */ { "result" : [ { "_id" : 14, "list" : [ { "_id" : ObjectId("587e21df6e79d255011a9c6a"), "vendor_id" : "user_101" }, { "_id" : ObjectId("587e21df6e79d255011a9c6b"), "vendor_id" : "user_101" } ] } ], "ok" : 1.0000000000000000 }

Pero cuando se hace lo mismo a través de laravel, se produce el siguiente error. $pipeline no es una lista (índice inesperado: "$group")

A continuación se muestra el código laravel

 $configuration_list = UserConfig::raw()->aggregate([ '$group' => [ '_id' => '$subscription_id', 'list' => ['$push' => ['_id' => '$_id', 'vendor_id' => '$vendor_id']] ] ] );

Alguien por favor me puede ayudar a resolver este problema..

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Envuelva los pasos de canalización de agregación en una matriz :

 $pipeline = [ [ '$group' => [ '_id' => '$subscription_id', 'list' => [ '$push' => [ '_id' => '$_id', 'vendor_id' => '$vendor_id' ] ] ] ] ]; $configuration_list = UserConfig::raw()->aggregate($pipeline);
over 4 years ago · Santiago Trujillo Report
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!