Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22872

Order by is not working in 3.2.3

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.3
    • Component/s: Querying
    • Labels:
      None
    • ALL
    • Hide

      The query:

      { "Keys.Queryables" : { "$in" : [/^PostType\|ArticlePost\|en_GB_/] }, "Keys.SortId" : { "$lt" : ObjectId("56d061a36afc7d277434ca87") } }
      

      The sorting order:

      {"Keys.Queryables": -1}
      

      or

      {"Keys.Queryables": 1}
      

      Notice that the documents are returned in the same order regardless of requesting ascending or descending.

      See the documents and indexes in the attached Word document.

      Show
      The query: { "Keys.Queryables" : { "$in" : [/^PostType\|ArticlePost\|en_GB_/] }, "Keys.SortId" : { "$lt" : ObjectId("56d061a36afc7d277434ca87") } } The sorting order: {"Keys.Queryables": -1} or {"Keys.Queryables": 1} Notice that the documents are returned in the same order regardless of requesting ascending or descending. See the documents and indexes in the attached Word document.

      I query on a collection with three documents, expecting to get documents back ordered by the "Keys.Queryables" field.

      This works as expected in 2.6.1, but in 3.2.3 the documents are always returned in ascending order.

        1. Query Bug.docx
          22 kB
        2. Query Bug with no pipe symbol.docx
          27 kB

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            itwebtf@saxobank.com ITWEBTF SAXOBANK
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: