adambird/entity_store — pull request #14 by gshutler (2014-05-28 08:16:00+00:00)
Title: Retrieve unsorted events from Mongo

When performing an $or query in Mongo, if you specify a sort it cannot use indexes. This led to some pretty severe performance implications.

Therefore, the sorting was moved in to code as generally this will be a cheap operation, outweighed by the time saved by doing multiple queries with one $or-based query.

http://docs.mongodb.org/manual/reference/operator/query/or/#or-and-sort-operations