|
|
@@ -240,35 +240,29 @@ proto.populate = function populate(callback) {
|
|
|
this.populated = true;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-klass.IteratorFromBsonArray = (function(){
|
|
|
+klass.IteratorFromCursor = (function(){
|
|
|
/**
|
|
|
* Helper class to unwind arrays within a series of documents.
|
|
|
* @param {String} unwindPath is the field path to the array to unwind.
|
|
|
**/
|
|
|
- var klass = function IteratorFromBsonArray(array){
|
|
|
- this._sorter = new SortDocumentSource();
|
|
|
- //this._iterator = new
|
|
|
+ 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.next = function next() {
|
|
|
- if (this.eof())
|
|
|
- return DocumentSource.EOF;
|
|
|
-
|
|
|
- var output = this.getCurrent();
|
|
|
- this.advance();
|
|
|
- return output;
|
|
|
- };
|
|
|
-
|
|
|
proto.more = function more() {
|
|
|
return this._cursor.more();
|
|
|
};
|
|
|
|
|
|
+ proto.next = function next() {
|
|
|
+ var doc = DocumentSourceMergeCursors(this._cursor);
|
|
|
+ // TODO: make_pair for return
|
|
|
+ //return {this._sorter.extractKey(doc): doc};
|
|
|
+ };
|
|
|
return klass;
|
|
|
})();
|
|
|
|
|
|
-
|
|
|
proto.populateFromCursors = function populateFromCursors(cursors){
|
|
|
for (var i = 0; i < cursors.lenth; i++) {
|
|
|
// TODO Create class
|
|
|
@@ -279,12 +273,35 @@ proto.populateFromCursors = function populateFromCursors(cursors){
|
|
|
|
|
|
}
|
|
|
|
|
|
+klass.IteratorFromBsonArray = (function(){
|
|
|
+ /**
|
|
|
+ * Helper class to unwind arrays within a series of documents.
|
|
|
+ * @param {String} unwindPath is the field path to the array to unwind.
|
|
|
+ **/
|
|
|
+ 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() {
|
|
|
+ var doc = DocumentSourceMergeCursors(this._cursor);
|
|
|
+ // TODO: make_pair for return
|
|
|
+ //return {this._sorter.extractKey(doc): doc};
|
|
|
+ };
|
|
|
+
|
|
|
+ proto.more = function more() {
|
|
|
+ return this._cursor.more();
|
|
|
+ };
|
|
|
+
|
|
|
+ return klass;
|
|
|
+})();
|
|
|
+
|
|
|
proto.populateFromBsonArrays = function populateFromBsonArrays(arrays){
|
|
|
for (var i = 0; i < arrays.lenth; i++) {
|
|
|
// TODO Create class
|
|
|
//this.iterators.push(boost::make_shared<IteratorFromBsonArray>(this, arrays[i]));
|
|
|
}
|
|
|
-
|
|
|
this._output.reset( ); // TODO: MySorter::Iterator::merge(iterators, makeSortOptions(), Comparator(*this))
|
|
|
}
|
|
|
/**
|