Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4435

Aggregations with sort operations aren't respected when saved as a view

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.24.1
    • Affects Version/s: 1.22.1
    • Component/s: Compass, CRUD
    • Labels:
      None
    • Environment:
      macOS Catalina 10.15.7
      docker image: mongo:4
      400 Documents
    • 1
    • Not Needed
    • Iteration Quince

      Take this sample pipeline:

      [
        {
          '$sort': {
            'date.dates': -1
          }
        }, {
          '$project': {
            'code': '$code.label', 
            'companyName': '$company.label', 
            'announcement': '$title.label', 
            'announcementLink': {
              '$arrayElemAt': [
                '$title.links', 0
              ]
            }, 
            'date': {
              '$arrayElemAt': [
                '$date.dates', 0
              ]
            }, 
            'announcementType': '$type.label', 
            'announcementDetail': '$announcementDetail', 
            'announcementDocuments': '$announcementDocuments', 
            'md5': '$md5'
          }
        }
      ]
      

       

      I'm finding that on this particular version of Compass it seems that when this pipeline is saved as a view. The sorting that should be applied simply isn't. No errors, no reason why... as a workaround, I have to add manually add {date: -1} to the sort field when viewing the view's documents.

      I've noticed that this is also happening when connecting to our production servers as well.

       

        1. Screen Shot 2020-10-06 at 11.48.36 PM.png
          588 kB
          David May
        2. Screen Shot 2020-10-06 at 11.50.01 PM.png
          531 kB
          David May

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            david@taggun.io David May
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: