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

sort function not working well

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.8
    • Component/s: Querying
    • Environment:
      ubuntu 12.04
    • Linux

      Hi Team,
      I am running mongodb on my production server ,mongodb version is 2.4.8.
      I have a collections in which I am storing datetime in every records ,but when i am sorting the results based on that column it result is not correct . Below are the details result with query . Please tell me where I was wrong ?

      db.version() ;
      2.4.8
      > db.raw_process.find(

      {"Username" : "tmp123@test123.com"}

      ,

      {"ServerTimestamp":1,"_id":0}

      ).sort(

      {"$ServerTimestamp" :-1}

      ).pretty() ;
      result are below :

      { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:40:21.115Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:41:44.955Z") }

      Type "it" for more
      > it

      { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.801Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:05.802Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") } { "ServerTimestamp" : ISODate("2013-12-28T12:42:32.369Z") }

            Assignee:
            Unassigned Unassigned
            Reporter:
            rajnish4mongodb Rajnish Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: