https://github.com/mongodb/mongo/blob/master/src/mongo/db/jsobj.cpp#L569

Ascending and descending appears to be decided by whether the ordering is positive or negative.