First Commit

This commit is contained in:
SowinskiBraeden committed 2020-11-25 09:10:06 -08:00
commit 601e886c14
2123 files changed
+334815

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
'use strict';
const Aspect = require('./operation').Aspect;
const defineAspects = require('./operation').defineAspects;
const OperationBase = require('./operation').OperationBase;
const nextObject = require('./common_functions').nextObject;
class NextOperation extends OperationBase {
constructor(cursor) {
super();
this.cursor = cursor;
}
execute(callback) {
const cursor = this.cursor;
// Return the currentDoc if someone called hasNext first
if (cursor.s.currentDoc) {
const doc = cursor.s.currentDoc;
cursor.s.currentDoc = null;
return callback(null, doc);
}
// Return the next object
nextObject(cursor, callback);
}
}
defineAspects(NextOperation, Aspect.SKIP_SESSION);
module.exports = NextOperation;