jstests/noPassthrough/change_stream_preimages_standalone_mode.js
// Returns the oplog entries written while performing the write operations.
Returns the oplog entries written while performing the write operations.
Returns the oplog entries written while performing the write operations .
function oplogEntriesForOps(db, writeOps) {
    const oplogColl = db.getSiblingDB('local').oplog.rs;
    const numOplogEntriesBefore = oplogColl.find().itcount();
    writeOps();
    const numOplogEntriesAfter = oplogColl.find().itcount();
    const numberOfNewOplogEntries = numOplogEntriesAfter - numOplogEntriesBefore;
    if (numberOfNewOplogEntries == 0) {
        return [];
    }
    return oplogColl.find().sort({ts: -1}).limit(numberOfNewOplogEntries).toArray();
}
function oplogEntriesForOps ( db , writeOps ) { const oplogColl = db . getSiblingDB ( 'local' ) . oplog . rs ; const numOplogEntriesBefore = oplogColl . find ( ) . itcount ( ) ; writeOps ( ) ; const numOplogEntriesAfter = oplogColl . find ( ) . itcount ( ) ; const numberOfNewOplogEntries = numOplogEntriesAfter - numOplogEntriesBefore ; if ( numberOfNewOplogEntries == 0 ) { return [ ] ; } return oplogColl . find ( ) . sort ( { ts : - 1 } ) . limit ( numberOfNewOplogEntries ) . toArray ( ) ; }
Returns the oplog entries written while performing the write operations.
Returns the oplog entries written while performing the write operations .
// Perform the write operations. // Check the number of oplog entries written.