Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-396

Unrecognized pipeline stage name: '$unwind'

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      I am trying to make an aggregate query using this simple array:

      [
                  [
                      '$match' => ['deck_id' => 18],
                  ],
                  [
                      '$project' => [
                          'stack' => 1,
                      ]
                  ],
                  [
                      '$unwind' => '$stack'
                  ],
                  [
                      '$group' => [
                          '_id' => '$stack.response',
                          'responses' => [
                              '$push' => '$$ROOT.stack'
                          ]
                      ]
                  ],
                  [
                      '$project' => [
                          'responses_count' => ['$size' => '$responses']
                      ]
                  ]
              ]

      But I am getting the following exception: Unrecognized pipeline stage name: '$unwind'

      **The following query in Robo 3T(an client for mongodb) works on the same server:

      db.getCollection('game_statistics').aggregate([
          {$match: {deck_id: 18}},
          {$project: {stack: 1}},
          {$unwind: "$stack"},
          {$group: {_id: "$stack.response", responses: {$push: "$$ROOT.stack"}}},
          {$project: {responses_count: {'$size': "$responses"}}}
      ])
      

        1. vQQW5dJV.php
          0.9 kB
          Derick Rethans

            Assignee:
            derick Derick Rethans
            Reporter:
            filipac filip pacurar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: