0
0
MongoDBquery~10 mins

Connection pooling concept in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a MongoDB client with connection pooling enabled.

MongoDB
const client = new MongoClient(uri, { [1]: 10 });
Drag options to blanks, or click blank then click option'
AmaxPoolSize
BpoolSize
Cconnections
DconnectionLimit
Attempts:
3 left
💡 Hint
Common Mistakes
Using poolSize which is deprecated in newer drivers.
Using connectionLimit which is not a valid option here.
2fill in blank
medium

Complete the code to connect the MongoDB client and log a success message.

MongoDB
await client.[1]();
console.log('Connected to MongoDB with pooling');
Drag options to blanks, or click blank then click option'
Astart
Binitialize
Copen
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using start() which does not exist.
Using open() which is not a MongoDB client method.
3fill in blank
hard

Fix the error in the code to properly close the MongoDB client connection pool.

MongoDB
await client.[1]();
Drag options to blanks, or click blank then click option'
Adisconnect
Bclose
Cshutdown
Dend
Attempts:
3 left
💡 Hint
Common Mistakes
Using disconnect() which is not a MongoDB client method.
Using end() which is not valid here.
4fill in blank
hard

Fill both blanks to create a MongoDB client with a max pool size of 20 and a timeout of 3000 ms.

MongoDB
const client = new MongoClient(uri, { [1]: 20, [2]: 3000 });
Drag options to blanks, or click blank then click option'
AmaxPoolSize
BconnectTimeoutMS
CsocketTimeoutMS
DpoolTimeout
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing socketTimeoutMS with connection timeout.
Using poolTimeout which is not a valid option.
5fill in blank
hard

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.

MongoDB
const client = new MongoClient(uri, { [1]: 50, [2]: 5000, [3]: 45000 });
Drag options to blanks, or click blank then click option'
AmaxPoolSize
BconnectTimeoutMS
CsocketTimeoutMS
DpoolSize
Attempts:
3 left
💡 Hint
Common Mistakes
Using poolSize instead of maxPoolSize.
Mixing up connectTimeoutMS and socketTimeoutMS.