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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 1.22.1
    • 1.24.1
    • Compass, CRUD
    • None
    • macOS Catalina 10.15.7
      docker image: mongo:4
      400 Documents
    • 1
    • Not Needed
    • Iteration Quince

    Description

      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.

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: