Uploaded image for project: 'PHP ORMs'
  1. PHP ORMs
  2. PHPORM-137

Test and fix Query\Builder::groupBy expression

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Laravel
    • None

      https://github.com/GromNaN/laravel-mongodb-private/pull/4#discussion_r1259060154

       

      This looks like a bug in:
      laravel-mongodb-private/src/Query/Builder.php

      Lines 251 to 257 in 06d3624

      I'm not sure why $last is used (the MySQL reference is lost on me), but there definitely needs to be some logic to avoid clobbering the _id field of the $group stage. If you actually want the incoming document's _id field to end up in a grouping, you need to project it into another field name. I'm not sure if there's an easy way to do that given the existing API but adding ['$last' => '$_id'] to the group ID seems very incorrect (even before we consider it being omitted from the output alongside "email").
       

            Assignee:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Reporter:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: