larvalabs/pullup — pull request #330 by tdhsmith (2014-04-07 03:37:07+00:00)
Title: Sort comments by date

According to #290, some comments are appearing out of chronological order. This adds an explicit date-sort query when getting news item comments. (Also adds me to userlist.)

I'm quite inexperienced at database wizardry, but after reading around[1] I suspect the issue is due to deletions. MongoDB's natural order isn't guaranteed to be identical to insertion order when documents are updated or removed, so occasionally comments from the same thread might be "jumping ahead" into an open database spot.

In any case, sorting the results before using them will solve the surface problem.

1. http://stackoverflow.com/a/11599283