Complete the code to create a MongoDB client with connection pooling enabled.
const client = new MongoClient(uri, { [1]: 10 });poolSize which is deprecated in newer drivers.connectionLimit which is not a valid option here.The maxPoolSize option sets the maximum number of connections in the pool for MongoDB clients.
Complete the code to connect the MongoDB client and log a success message.
await client.[1](); console.log('Connected to MongoDB with pooling');
start() which does not exist.open() which is not a MongoDB client method.The connect() method establishes the connection pool and connects the client to the MongoDB server.
Fix the error in the code to properly close the MongoDB client connection pool.
await client.[1]();disconnect() which is not a MongoDB client method.end() which is not valid here.The close() method properly closes all connections in the pool and releases resources.
Fill both blanks to create a MongoDB client with a max pool size of 20 and a timeout of 3000 ms.
const client = new MongoClient(uri, { [1]: 20, [2]: 3000 });socketTimeoutMS with connection timeout.poolTimeout which is not a valid option.maxPoolSize sets the max connections in the pool, and connectTimeoutMS sets the connection timeout in milliseconds.
Fill all three blanks to create a MongoDB client with a max pool size of 50, a connect timeout of 5000 ms, and a socket timeout of 45000 ms.
const client = new MongoClient(uri, { [1]: 50, [2]: 5000, [3]: 45000 });poolSize instead of maxPoolSize.connectTimeoutMS and socketTimeoutMS.Use maxPoolSize for max connections, connectTimeoutMS for connection timeout, and socketTimeoutMS for socket inactivity timeout.