jstests/libs/change_stream_util.js
/**
 * Asserts that the given opType triggers an invalidate entry depending on the type of change
 * stream.
 *     - single collection streams: drop, rename, and dropDatabase.
 *     - whole DB streams: dropDatabase.
 *     - whole cluster streams: none.
 * Returns the invalidate document if there was one, or null otherwise.
 */
Asserts that the given opType triggers an invalidate entry depending on the type of change
stream.
- single collection streams: drop, rename, and dropDatabase.
- whole DB streams: dropDatabase.
- whole cluster streams: none.
Returns the invalidate document if there was one, or null otherwise.
Asserts that the given opType triggers an invalidate entry depending on the type of change stream . - single collection streams : drop rename and dropDatabase . - whole DB streams : dropDatabase . - whole cluster streams : none . Returns the invalidate document if there was one or null otherwise .
function assertInvalidateOp({cursor, opType}) {
    if (!isChangeStreamPassthrough() ||
        (changeStreamPassthroughType() == ChangeStreamWatchMode.kDb && opType == "dropDatabase")) {
        assert.soon(() => cursor.hasNext());
        const invalidate = cursor.next();
        assert.eq(invalidate.operationType, "invalidate");
        assert(!cursor.hasNext());
        assert(cursor.isExhausted());
        assert(cursor.isClosed());
        return invalidate;
    }
    return null;
}
function assertInvalidateOp ( { cursor , opType } ) { if ( ! isChangeStreamPassthrough ( ) || ( changeStreamPassthroughType ( ) == ChangeStreamWatchMode . kDb && opType == "dropDatabase" ) ) { assert . soon ( ( ) => cursor . hasNext ( ) ) ; const invalidate = cursor . next ( ) ; assert . eq ( invalidate . operationType , "invalidate" ) ; assert ( ! cursor . hasNext ( ) ) ; assert ( cursor . isExhausted ( ) ) ; assert ( cursor . isClosed ( ) ) ; return invalidate ; } return null ; }
Asserts that the given opType triggers an invalidate entry depending on the type of change
 stream.
Asserts that the given opType triggers an invalidate entry depending on the type of change stream .