Implementation of Issue #1843 but some tests are still failed.
Issue #1843 tests for "order by" full optimization by composite indexes were added.
Issue #1843 tests for "order by" when  collection is sorted only partially by  index were added.
Issue #1843 tests for "order by" for local and remote storage were passed.
Issue #1843 tests for "order by" for memory storage were passed. Issue was fixed.