lib/mongodb/mongodb/lib/operations/cursor_ops.js
function hasNext(cursor, callback) {
  const Cursor = require('../cursor');

  if (cursor.s.currentDoc) {
    return callback(null, true);
  }

  if (cursor.isNotified()) {
    return callback(null, false);
  }

  nextObject(cursor, (err, doc) => {
    if (err) return callback(err, null);
    if (cursor.s.state === Cursor.CLOSED || cursor.isDead()) return callback(null, false);
    if (!doc) return callback(null, false);
    cursor.s.currentDoc = doc;
    callback(null, true);
  });
}
function hasNext(cursor, callback) {
  const Cursor = require('../cursor');

  if (cursor.s.currentDoc) {
    return callback(null, true);
  }

  if (cursor.isNotified()) {
    return callback(null, false);
  }

  nextObject(cursor, (err, doc) => {
    if (err) return callback(err, null);
    if (cursor.s.state === Cursor.CLOSED || cursor.isDead()) return callback(null, false);
    if (!doc) return callback(null, false);
    cursor.s.currentDoc = doc;
    callback(null, true);
  });
}
function hasNext ( cursor , callback ) { const Cursor = require ( '../cursor' ) ; if ( cursor . s . currentDoc ) { return callback ( null , true ) ; } if ( cursor . isNotified ( ) ) { return callback ( null , false ) ; } nextObject ( cursor , ( err , doc ) => { if ( err ) return callback ( err , null ) ; if ( cursor . s . state === Cursor . CLOSED || cursor . isDead ( ) ) return callback ( null , false ) ; if ( ! doc ) return callback ( null , false ) ; cursor . s . currentDoc = doc ; callback ( null , true ) ; } ) ; }
Check if there is any document still available in the cursor.

@method
@param {Cursor} cursor The Cursor instance on which to run.
@param {Cursor~resultCallback} [callback] The result callback.
Check if there is any document still available in the cursor .