jstests/concurrency/fsm_workloads/update_simple.js
// explicitly pass db to avoid accidentally using the global `db`
explicitly pass db to avoid accidentally using the global `db`
explicitly pass db to avoid accidentally using the global ` db `
function assertResult(db, res) {
                assertAlways.eq(0, res.nUpserted, tojson(res));
                if (isMongod(db) && !isMMAPv1(db)) {
                    assertWhenOwnColl.eq(res.nMatched, 1, tojson(res));
                }
                else {
                    assertWhenOwnColl.contains(res.nMatched, [0, 1], tojson(res));
                }
                if (db.getMongo().writeMode() === 'commands') {
                    assertWhenOwnColl.contains(res.nModified, [0, 1], tojson(res));
                }
            }
function assertResult ( db , res ) { assertAlways . eq ( 0 , res . nUpserted , tojson ( res ) ) ; if ( isMongod ( db ) && ! isMMAPv1 ( db ) ) { assertWhenOwnColl . eq ( res . nMatched , 1 , tojson ( res ) ) ; } else { assertWhenOwnColl . contains ( res . nMatched , [ 0 , 1 ] , tojson ( res ) ) ; } if ( db . getMongo ( ) . writeMode ( ) === 'commands' ) { assertWhenOwnColl . contains ( res . nModified , [ 0 , 1 ] , tojson ( res ) ) ; } }
explicitly pass db to avoid accidentally using the global `db`
explicitly pass db to avoid accidentally using the global ` db `
// For non-mmap storage engines we can have a strong assertion that exactly one // doc will be modified. // Zero matches are possible for MMAP v1 because the update will skip a document // that was invalidated during a yield. // We can't be sure nModified will be non-zero because we may have just set a key to // its existing value