Cannot sort with aggregation by an array entry

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.4.4
    • Component/s: Aggregation Framework
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Cannot sort with aggregation when we have more than one key to sort and one of this are an array entry

      No problem if only one key specified:

      collection.aggregate([{
          $sort:{
              "events.0.date": -1
              }}])
      

      Problem if more than one key specified and one of this is an array entry:

      collection.aggregate([{
          $sort:{
              "events.0.date": -1,
              "_id":1
              }}])
      

      I checked :

      collection.aggregate([{
          $sort:{
              "date": -1,
              "_id":1
              }}])
      

      Sorry for my english

        1. reproduce
          4 kB
          L. Page

              Assignee:
              Mark Agarunov (Inactive)
              Reporter:
              L. Page
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: