|
|
@@ -254,6 +254,27 @@ klass.parseDeps = function parseDeps(deps) {
|
|
|
return md;
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * A function compatible as a getNext for document sources.
|
|
|
+ * Does nothing except pass the documents through. To use,
|
|
|
+ * Attach this function on a DocumentSource prototype.
|
|
|
+ *
|
|
|
+ * @method GET_NEXT_PASS_THROUGH
|
|
|
+ * @param callback {Function}
|
|
|
+ * @param callback.err {Error} An error or falsey
|
|
|
+ * @param callback.doc {Object} The source's next object or DocumentSource.EOF
|
|
|
+ **/
|
|
|
+klass.GET_NEXT_PASS_THROUGH = function GET_NEXT_PASS_THROUGH(callback) {
|
|
|
+ if (!callback) throw new Error(this.getSourceName() + ' #getNext() requires callback');
|
|
|
+
|
|
|
+ var out;
|
|
|
+ this.source.getNext(function(err, doc) {
|
|
|
+ out = doc;
|
|
|
+ return callback(err, doc);
|
|
|
+ });
|
|
|
+ return out; // For the sync people in da house
|
|
|
+};
|
|
|
+
|
|
|
klass.documentFromJsonWithDeps = function documentFromJsonWithDeps(bson, neededFields) {
|
|
|
var arrayHelper = function(bson, neededFields) {
|
|
|
var values = [];
|