|
|
@@ -195,7 +195,6 @@ proto.makeSortOptions = function makeSortOptions(){
|
|
|
proto.populate = function populate(callback) {
|
|
|
if ( this._mergePresorted ){
|
|
|
// Skipping stuff about mergeCursors and commandShards
|
|
|
-console.log('never here');
|
|
|
|
|
|
if ( this.source instanceof MergeCursorDocumentSouce ){
|
|
|
populateFromCursors( this.source);
|
|
|
@@ -251,11 +250,11 @@ klass.IteratorFromCursor = (function(){
|
|
|
var klass = function IteratorFromCursor(sorter, cursor){
|
|
|
this._sorter = new SortDocumentSource(sorter);
|
|
|
//this._cursor = new DBClientCursor(cursor);
|
|
|
-
|
|
|
+
|
|
|
}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
|
- proto.more = function more() {
|
|
|
- return this._cursor.more();
|
|
|
+ proto.more = function more() {
|
|
|
+ return this._cursor.more();
|
|
|
};
|
|
|
|
|
|
proto.next = function next() {
|
|
|
@@ -284,7 +283,7 @@ klass.IteratorFromBsonArray = (function(){
|
|
|
var klass = function IteratorFromBsonArray(sorter, array){
|
|
|
this._sorter = new SortDocumentSource(sorter);
|
|
|
//this._iterator = new BSONObjIterator(array);
|
|
|
-
|
|
|
+
|
|
|
}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
|
proto.next = function next() {
|
|
|
@@ -293,8 +292,8 @@ klass.IteratorFromBsonArray = (function(){
|
|
|
//return {this._sorter.extractKey(doc): doc};
|
|
|
};
|
|
|
|
|
|
- proto.more = function more() {
|
|
|
- return this._cursor.more();
|
|
|
+ proto.more = function more() {
|
|
|
+ return this._cursor.more();
|
|
|
};
|
|
|
|
|
|
return klass;
|
|
|
@@ -406,7 +405,7 @@ klass.createFromJson = function createFromJson(elem, expCtx) {
|
|
|
* Creates a new SortDocumentSource
|
|
|
*
|
|
|
* @param {Object} expCtx
|
|
|
- * @param {object} sortorder
|
|
|
+ * @param {object} sortorder
|
|
|
* @param {int} limit
|
|
|
*
|
|
|
**/
|
|
|
@@ -447,7 +446,7 @@ klass.create = function create(expCtx, sortOrder, limit) {
|
|
|
|
|
|
if (sortKeys <= 0) throw new Error("code 15976; " + klass.sortName + " must have at least one sort key");
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if ( limit > 0) {
|
|
|
var coalesced = nextSort.coalesce( create(expCtx, limit));
|
|
|
// should always coalesce
|