Wrong sort sometimes when based on two fields

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.4.6
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I write a sample test on: https://github.com/GaoJianAllen/MongoTest

      When use sort method to sort fields, it will return wrong sort result sometime.

      Key code:

       

      cursor, err := coll.Find(context.TODO(), bson.M{}, options.Find().SetSort(
         bson.M{"type": 1, "created": -1}))
      

      Expect:

      Actual(Sometimes):

       

      Command is always correct.

      db.coll.find().sort({"type": 1, "created_at":-1})
      

       

              Assignee:
              Unassigned
              Reporter:
              Allen Gao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: