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

Array ordering semantics are different with index than without an index

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.9.1
    • None
    • None
    • None
    • ALL

    Description

      > db.c.save(

      {a:[1,10]}

      );
      > db.c.save(

      {a:5}

      );
      > db.c.find().sort(

      {a:1}

      )

      { "_id" : ObjectId("4d95731036d6ac4c79650e64"), "a" : 5 } { "_id" : ObjectId("4d95730836d6ac4c79650e63"), "a" : [ 1, 10 ] }

      > db.c.find().sort(

      {a:-1}

      )

      { "_id" : ObjectId("4d95730836d6ac4c79650e63"), "a" : [ 1, 10 ] } { "_id" : ObjectId("4d95731036d6ac4c79650e64"), "a" : 5 }

      > db.c.ensureIndex(

      {a:1}

      );
      > db.c.find().sort(

      {a:1}

      )

      { "_id" : ObjectId("4d95730836d6ac4c79650e63"), "a" : [ 1, 10 ] } { "_id" : ObjectId("4d95731036d6ac4c79650e64"), "a" : 5 }

      > db.c.find().sort(

      {a:-1}

      )

      { "_id" : ObjectId("4d95730836d6ac4c79650e63"), "a" : [ 1, 10 ] } { "_id" : ObjectId("4d95731036d6ac4c79650e64"), "a" : 5 }

      >

      Attachments

        Activity

          People

            aaron Aaron Staple
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: