lib/mongodb/mongodb-core/lib/wireprotocol/3_2_support.js
function killCursorCallback(err, result) {
    if (err) {
      if (typeof callback !== 'function') return;
      return callback(err);
    }

    // Result
    const r = result.message;
    // If we have a timed out query or a cursor that was killed
    if ((r.responseFlags & (1 << 0)) !== 0) {
      if (typeof callback !== 'function') return;
      return callback(new MongoNetworkError('cursor killed or timed out'), null);
    }

    if (!Array.isArray(r.documents) || r.documents.length === 0) {
      if (typeof callback !== 'function') return;
      return callback(
        new MongoError(`invalid killCursors result returned for cursor id ${cursorId}`)
      );
    }

    // Return the result
    if (typeof callback === 'function') {
      callback(null, r.documents[0]);
    }
  }
function killCursorCallback(err, result) {
    if (err) {
      if (typeof callback !== 'function') return;
      return callback(err);
    }

    // Result
    const r = result.message;
    // If we have a timed out query or a cursor that was killed
    if ((r.responseFlags & (1 << 0)) !== 0) {
      if (typeof callback !== 'function') return;
      return callback(new MongoNetworkError('cursor killed or timed out'), null);
    }

    if (!Array.isArray(r.documents) || r.documents.length === 0) {
      if (typeof callback !== 'function') return;
      return callback(
        new MongoError(`invalid killCursors result returned for cursor id ${cursorId}`)
      );
    }

    // Return the result
    if (typeof callback === 'function') {
      callback(null, r.documents[0]);
    }
  }
function killCursorCallback ( err , result ) { if ( err ) { if ( typeof callback !== 'function' ) return ; return callback ( err ) ; } // Result const r = result . message ; // If we have a timed out query or a cursor that was killed if ( ( r . responseFlags & ( 1 << 0 ) ) !== 0 ) { if ( typeof callback !== 'function' ) return ; return callback ( new MongoNetworkError ( 'cursor killed or timed out' ) , null ) ; } if ( ! Array . isArray ( r . documents ) || r . documents . length === 0 ) { if ( typeof callback !== 'function' ) return ; return callback ( new MongoError ( ` ${ cursorId } ` ) ) ; } // Return the result if ( typeof callback === 'function' ) { callback ( null , r . documents [ 0 ] ) ; } }
Kill cursor callback
Kill cursor callback