Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1904

Wrong sort sometimes when based on two fields

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.4.6
    • Component/s: API
    • 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})
      

       

        1. image-2021-03-02-15-44-03-874.png
          36 kB
          Allen Gao
        2. image-2021-03-02-15-44-45-097.png
          36 kB
          Allen Gao

            Assignee:
            Unassigned Unassigned
            Reporter:
            jian.gao1@hp.com Allen Gao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: