Skip to content

Instantly share code, notes, and snippets.

@powdahound
Created August 13, 2010 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save powdahound/523178 to your computer and use it in GitHub Desktop.
Save powdahound/523178 to your computer and use it in GitHub Desktop.
Document creation:
ret.add(doc.date, {
"field": "date_str"
});
Request: ?limit=50&skip=0&stale=ok&sort=\date_str&include_docs=true&q=group<int>:2
Response's sort_order:
Array
(
[0] => Array
(
[field] => date_str
[reverse] => 1
[type] => string
)
)
Dates in rows:
2010-08-12T22:55:57Z 907322
2010-08-12T22:07:04Z 758625
2010-08-13T16:33:35Z 633324 <-- huh?
2010-08-12T21:47:23Z 612094
2010-08-12T22:06:59Z 590199
2010-08-12T21:47:21Z 572028
2010-08-12T22:03:43Z 562520
2010-08-12T23:32:55Z 186480
2010-08-12T21:47:26Z 547685
2010-08-12T22:03:53Z 050538
2010-08-12T22:23:52Z 212587
2010-08-12T22:11:48Z 265739
2010-08-12T22:06:02Z 380757
2010-08-12T18:28:36Z 172178
2010-08-12T22:12:01Z 082473
If I sort ascending instead:
2010-08-12T22:12:01Z 082473
2010-08-12T18:28:36Z 172178
2010-08-12T22:06:02Z 380757
2010-08-12T22:11:48Z 265739
2010-08-12T22:23:52Z 212587
2010-08-12T22:03:53Z 050538
2010-08-12T21:47:26Z 547685
2010-08-12T23:32:55Z 186480
2010-08-12T22:03:43Z 562520
2010-08-12T21:47:21Z 572028
2010-08-12T22:06:59Z 590199
2010-08-12T21:47:23Z 612094
2010-08-13T16:33:35Z 633324 <-- huh?
2010-08-12T22:07:04Z 758625
2010-08-12T22:55:57Z 907322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment