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

$sort doesn't work in combination with $out

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.3
    • Component/s: Aggregation Framework
    • Labels:
      None
    • ALL

      Source collection with unsorted fields:

       

      Results redirected to another database are not sorted. I suspect it's a bug.

      [{'$match': {}}, {'$sort': SON([('chrom', 1), ('start', 1), ('end', 1)])}, {'$out': {'db': 'synth_BED_out', 'coll': 'bed_3_query_res.bed'}}]

       

      Results, obtained through the cursor, are sorted. It's expected by me.

      [{'$match': {}}, {'$sort': SON([('chrom', 1), ('start', 1), ('end', 1)])}]

       

        1. src_unsrtd_coll.png
          src_unsrtd_coll.png
          58 kB
        2. trg_srtd_table.png
          trg_srtd_table.png
          34 kB
        3. image-2021-02-05-21-49-55-431.png
          image-2021-02-05-21-49-55-431.png
          63 kB

            Assignee:
            edwin.zhou@mongodb.com Edwin Zhou
            Reporter:
            platon.work@gmail.com Platon workaccount
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: