Skip to content

Commit

Permalink
Use new sorter + projection api in oplog code
Browse files Browse the repository at this point in the history
  • Loading branch information
Slava committed Feb 28, 2014
1 parent c14e41a commit 571ba01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/mongo-livedata/oplog_observe_driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ OplogObserveDriver = function (options) {
}

var sortSpec = options.cursorDescription.options.sort;
var sorter = sortSpec && new Minimongo.Sorter(sortSpec);
var comparator = sorter && sorter.getComparator();

if (options.cursorDescription.options.limit) {
// There are several properties ordered driver implements:
Expand All @@ -52,8 +54,6 @@ OplogObserveDriver = function (options) {

// We don't support $near and other geo-queries so it's OK to initialize the
// comparator only once in the constructor.
var sorter = new Minimongo.Sorter(sortSpec);
var comparator = sorter.getComparator();
var heapOptions = { IdMap: LocalCollection._IdMap };
self._limit = self._cursorDescription.options.limit;
self._comparator = comparator;
Expand Down Expand Up @@ -87,8 +87,8 @@ OplogObserveDriver = function (options) {
// Projection function, result of combining important fields for selector and
// existing fields projection
self._sharedProjection = self._matcher.combineIntoProjection(projection);
if (sortSpec)
self._sharedProjection = Minimongo.Sorter.combineSpecIntoProjection(sortSpec, self._sharedProjection);
if (sorter)
self._sharedProjection = sorter.combineIntoProjection(self._sharedProjection);
self._sharedProjectionFn = LocalCollection._compileProjection(
self._sharedProjection);

Expand Down

0 comments on commit 571ba01

Please sign in to comment.