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

when field name is number,sort by multiple fields is incorrect

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.4
    • Component/s: Querying
    • None
    • ALL

      when field name is number,sort the result like this:

      db.test.find().sort({"505":-1,"504":1 });
      

      ,and the result is:

      {
          "_id" : ObjectId("5ac30f8761d473226afba2f3"),
          "503" : "12asdt",
          "504" : 10,
          "505" : 0.12,
          "506" : 10
      }
      
      /* 2 */
      {
          "_id" : ObjectId("5ac2de8ab25cfdcfa67ddeca"),
          "503" : "abdc",
          "504" : 12,
          "505" : 12.3,
          "506" : 12
      }
      
      /* 3 */
      {
          "_id" : ObjectId("5ac2de9cb25cfdcfa67dded4"),
          "503" : "t2q3t",
          "504" : 12,
          "505" : 12.1,
          "506" : 12
      }
      
      /* 4 */
      {
          "_id" : ObjectId("5ac2de5eb25cfdcfa67ddeaf"),
          "503" : "abcd",
          "504" : 13,
          "505" : 3.6,
          "506" : 13
      }
      
      /* 5 */
      {
          "_id" : ObjectId("5ac2de7bb25cfdcfa67ddec3"),
          "503" : "ttwewqet",
          "504" : 13,
          "505" : 0.12,
          "506" : 13
      }
      
      /* 6 */
      {
          "_id" : ObjectId("5ac2dea9b25cfdcfa67ddedb"),
          "503" : "ttwewqet",
          "504" : 14,
          "505" : 0.12,
          "506" : 14
      }
      

      result is not correspond to the sort param。But it's right when filed name is characters.

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            deng_yong365 deng yong
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: