Complete the code to start a transaction in MongoDB.
const session = client.startSession();
session.[1]();In MongoDB, startTransaction() is the correct method to begin a transaction within a session.
Complete the code to commit a transaction in MongoDB.
await session.[1]();The correct method to commit a transaction in MongoDB is commitTransaction().
Fix the error in the code to abort a transaction properly.
await session.[1]();The correct method to abort a transaction in MongoDB is abortTransaction().
Fill both blanks to set transaction options for read concern and write concern.
const transactionOptions = {
readConcern: { level: '[1]' },
writeConcern: { w: '[2]' }
};Setting readConcern to 'local' and writeConcern to '1' is a common way to balance performance and consistency.
Fill all three blanks to create a transaction with options and start it.
const session = client.startSession();
const options = { readConcern: { level: '[1]' }, writeConcern: { w: '[2]' } };
session.[3](options);This code sets readConcern to 'majority', writeConcern to '1', and starts the transaction with startTransaction().