jstests/concurrency/fsm_workloads/server_status_with_time_out_cursors.js
/**
         * Runs a query on the collection with a small enough batchSize to leave the cursor open.
         * If the command was successful, stores the resulting cursor in 'this.cursor'.
         */
Runs a query on the collection with a small enough batchSize to leave the cursor open.
If the command was successful, stores the resulting cursor in 'this.cursor'.
Runs a query on the collection with a small enough batchSize to leave the cursor open . If the command was successful stores the resulting cursor in ' this . cursor ' .
function query(db, collName) {
            try {
                let curs = db[collName]
                               .find({
                                   $where: function() {
                                       sleep(1);
                                       return true;
                                   }
                               })
                               .batchSize(2)
                               .maxTimeMS(10);
                const c = curs.itcount();
            } catch (e) {
                assert.commandFailedWithCode(
                    e, [ErrorCodes.MaxTimeMSExpired, ErrorCodes.NetworkInterfaceExceededTimeLimit]);
            }
        }
function query ( db , collName ) { try { let curs = db [ collName ] . find ( { $where : function ( ) { sleep ( 1 ) ; return true ; } } ) . batchSize ( 2 ) . maxTimeMS ( 10 ) ; const c = curs . itcount ( ) ; } catch ( e ) { assert . commandFailedWithCode ( e , [ ErrorCodes . MaxTimeMSExpired , ErrorCodes . NetworkInterfaceExceededTimeLimit ] ) ; } }
Runs a query on the collection with a small enough batchSize to leave the cursor open.
Runs a query on the collection with a small enough batchSize to leave the cursor open .
// Set a low maxTimeMs and small batch size so that it's likely the cursor will // time out over its lifetime.