-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.2
-
Component/s: Aggregation Framework
-
None
-
ALL
-
The code below produces this:
{ "_id" : ObjectId("5537436ea93a16b4e1d4ad17"), "data" : [ { "f" : 1, "v" : "Charles" } ] } { "_id" : ObjectId("5537436ea93a16b4e1d4ad16"), "data" : [ { "f" : 1, "v" : "Bob" } ] } { "_id" : ObjectId("5537436ea93a16b4e1d4ad15"), "data" : [ { "f" : 1, "v" : "Adam" } ] }
But it seems to me it should be the reverse. Changing the 1 to -1 in the $sort seems to reverse it again so it's in alphabetical order.
Oddly, the phenomenon is not always consistent – it seems to be consistent when run via the console, but when I run the equivalent code via either PHP or Ruby, the records are sometimes ordered CAB or ACB etc.
Tested on both WT and MMAPv1.