jstests/core/txns/libs/prepare_helpers.js
/**
     * Prepares the active transaction on the session. This expects the 'prepareTransaction' command
     * to succeed and return a non-null 'prepareTimestamp'.
     *
     * @return {Timestamp} the transaction's prepareTimestamp
     */
Prepares the active transaction on the session. This expects the 'prepareTransaction' command
to succeed and return a non-null 'prepareTimestamp'.

@return {Timestamp} the transaction's prepareTimestamp
Prepares the active transaction on the session . This expects the ' prepareTransaction ' command to succeed and return a non - null ' prepareTimestamp ' . @return { Timestamp } the transaction ' s prepareTimestamp
function prepareTransaction(session, writeConcernOption = {w: "majority"}) {
        assert(session);
        const res = assert.commandWorked(session.getDatabase('admin').adminCommand(
            {prepareTransaction: 1, writeConcern: writeConcernOption}));
        assert(res.prepareTimestamp,
               "prepareTransaction did not return a 'prepareTimestamp': " + tojson(res));
        const prepareTimestamp = res.prepareTimestamp;
        assert(prepareTimestamp instanceof Timestamp,
               'prepareTimestamp was not a Timestamp: ' + tojson(res));
        assert.neq(
            prepareTimestamp, Timestamp(0, 0), "prepareTimestamp cannot be null: " + tojson(res));
        return prepareTimestamp;
    }
function prepareTransaction ( session , writeConcernOption = { w : "majority" } ) { assert ( session ) ; const res = assert . commandWorked ( session . getDatabase ( 'admin' ) . adminCommand ( { prepareTransaction : 1 , writeConcern : writeConcernOption } ) ) ; assert ( res . prepareTimestamp , "prepareTransaction did not return a 'prepareTimestamp': " + tojson ( res ) ) ; const prepareTimestamp = res . prepareTimestamp ; assert ( prepareTimestamp instanceof Timestamp , 'prepareTimestamp was not a Timestamp: ' + tojson ( res ) ) ; assert . neq ( prepareTimestamp , Timestamp ( 0 , 0 ) , "prepareTimestamp cannot be null: " + tojson ( res ) ) ; return prepareTimestamp ; }
Prepares the active transaction on the session.
Prepares the active transaction on the session .