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") }